diff options
author | Martin Storsjö <martin@martin.st> | 2012-08-30 23:10:07 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-08-31 00:44:35 +0300 |
commit | bcc44873d949bd817fa19fad368604cf73ccee78 (patch) | |
tree | e8df451c1beea05e6c48e94cf270fafb5f3a3972 /tools | |
parent | 372de27df78b85976991bfe321a43b62b8505276 (diff) | |
download | ffmpeg-streaming-bcc44873d949bd817fa19fad368604cf73ccee78.zip ffmpeg-streaming-bcc44873d949bd817fa19fad368604cf73ccee78.tar.gz |
pktdumper: Use av_strlcpy instead of strncpy
This takes care of null-terminating the buffer if it is too small,
which wasn't handled properly before.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/pktdumper.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/pktdumper.c b/tools/pktdumper.c index fffeeeb..f21a8e0 100644 --- a/tools/pktdumper.c +++ b/tools/pktdumper.c @@ -31,6 +31,7 @@ #include <io.h> #endif +#include "libavutil/avstring.h" #include "libavutil/time.h" #include "libavformat/avformat.h" @@ -70,9 +71,9 @@ int main(int argc, char **argv) return usage(1); if (argc > 2) maxpkts = atoi(argv[2]); - strncpy(fntemplate, argv[1], sizeof(fntemplate) - 1); + av_strlcpy(fntemplate, argv[1], sizeof(fntemplate)); if (strrchr(argv[1], '/')) - strncpy(fntemplate, strrchr(argv[1], '/') + 1, sizeof(fntemplate) - 1); + av_strlcpy(fntemplate, strrchr(argv[1], '/') + 1, sizeof(fntemplate)); if (strrchr(fntemplate, '.')) *strrchr(fntemplate, '.') = '\0'; if (strchr(fntemplate, '%')) { |