avformat/sdp: Check before appending ","

Found by reviewing code related to CID1500301 String not null terminated

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5b82852519)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/6.1
Michael Niedermayer 8 months ago
parent 22d2a4eb34
commit 6b4165643d
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 3
      libavformat/sdp.c

@ -202,6 +202,8 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par,
continue;
}
if (p != (psets + strlen(pset_string))) {
if (p - psets >= MAX_PSET_SIZE)
goto fail_in_loop;
*p = ',';
p++;
}
@ -212,6 +214,7 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par,
if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {
av_log(s, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n",
MAX_PSET_SIZE - (p - psets), r1 - r);
fail_in_loop:
av_free(psets);
av_free(tmpbuf);

Loading…
Cancel
Save