aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-08-30 23:10:07 +0300
committerMartin Storsjö <martin@martin.st>2012-08-31 00:44:35 +0300
commitbcc44873d949bd817fa19fad368604cf73ccee78 (patch)
treee8df451c1beea05e6c48e94cf270fafb5f3a3972
parent372de27df78b85976991bfe321a43b62b8505276 (diff)
downloadffmpeg-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>
-rw-r--r--tools/pktdumper.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index fffeeeb70a..f21a8e01e7 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, '%')) {