]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sdp.c
avformat/sdp: Fix potential write beyond end of buffer
[ffmpeg] / libavformat / sdp.c
index 34e9839b67aa20993132ee6237710b8a02411a5d..2ce1a62262defbd965e0720ab9283ba56b533fa3 100644 (file)
@@ -212,7 +212,7 @@ static char *extradata2psets(AVFormatContext *s, AVCodecParameters *par)
         p += strlen(p);
         r = r1;
     }
-    if (sps && sps_end - sps >= 4) {
+    if (sps && sps_end - sps >= 4 && p - psets <= MAX_PSET_SIZE - strlen(profile_string) - 7) {
         memcpy(p, profile_string, strlen(profile_string));
         p += strlen(p);
         ff_data_to_hex(p, sps + 1, 3, 0);