mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
parent
372de27df7
commit
bcc44873d9
@ -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, '%')) {
|
||||
|
Loading…
Reference in New Issue
Block a user