History

avformat/sdp: Check before appending ","

Found by reviewing code related to CID1500301 String not null terminated

Michael Niedermayer committed 2 years ago

Commit 5b828521 parent a3d3a581 file · +3 −0Browse files

Showing the changes to libavformat (1 of 1 file). Show all

Unified · Split

libavformat/sdp.c+3−0
@@ -203,6 +203,8 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par, · 202 unmodified lines
203 continue;203 continue;
204 }204 }
205 if (p != (psets + strlen(pset_string))) {205 if (p != (psets + strlen(pset_string))) {
206 if (p - psets >= MAX_PSET_SIZE)
207 goto fail_in_loop;
206 *p = ',';208 *p = ',';
207 p++;209 p++;
208 }210 }
@@ -213,6 +215,7 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par, · 4 unmodified lines
213 if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {215 if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {
214 av_log(s, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n",216 av_log(s, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n",
215 MAX_PSET_SIZE - (p - psets), r1 - r);217 MAX_PSET_SIZE - (p - psets), r1 - r);
218fail_in_loop:
216 av_free(psets);219 av_free(psets);
217 av_free(tmpbuf);220 av_free(tmpbuf);
218 221

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t