[FFmpeg-devel] [PATCH] find_info_tag: Make sure the output buffer is null terminated

Martin Storsjo martin
Tue Oct 5 15:24:48 CEST 2010


Currently, a tag without a = character makes the function return 1
but leaves the arg buffer untouched (and thus not null terminated).
---
 libavformat/utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5985511..a545a5d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3361,8 +3361,8 @@ int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
                 }
                 p++;
             }
-            *q = '\0';
         }
+        *q = '\0';
         if (!strcmp(tag, tag1))
             return 1;
         if (*p != '&')
-- 
1.7.3.1




More information about the ffmpeg-devel mailing list