diff options
author | Philip Gladstone <philipjsg@users.sourceforge.net> | 2002-05-10 02:17:41 +0000 |
---|---|---|
committer | Philip Gladstone <philipjsg@users.sourceforge.net> | 2002-05-10 02:17:41 +0000 |
commit | 8d1335ea2b77d71a7f17db47f65b43758ea56a2f (patch) | |
tree | 49cdc3fb4b9b68c75fdf93fa135b81a2d8268601 /libav/utils.c | |
parent | 283383715f5399db2f7e6182f70268c07ff55a90 (diff) | |
download | ffmpeg-8d1335ea2b77d71a7f17db47f65b43758ea56a2f.tar.gz |
* Add implementation of strlcpy
* Fix endless loop in find_info_tag if given specific arguments
Originally committed as revision 481 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/utils.c')
-rw-r--r-- | libav/utils.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libav/utils.c b/libav/utils.c index 8520656a1b..161e72ceef 100644 --- a/libav/utils.c +++ b/libav/utils.c @@ -124,6 +124,18 @@ void nstrcpy(char *buf, int buf_size, const char *str) *q = '\0'; } +void strlcpy(char *dst, const char *src, int len) +{ + int slen = strlen(src) + 1; + + if (slen <= len) { + memcpy(dst, src, slen); + } else { + memcpy(dst, src, len - 1); + dst[len - 1] = 0; + } +} + void register_all(void) { avcodec_init(); @@ -561,6 +573,7 @@ int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) return 1; if (*p != '&') break; + p++; } return 0; } |