Skip to content

Commit 560a134

Browse files
authored
Merge pull request from GHSA-f5qg-pqcg-765m
1 parent 601f0c7 commit 560a134

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Diff for: pjmedia/src/pjmedia/sdp.c

+14-5
Original file line numberDiff line numberDiff line change
@@ -733,12 +733,21 @@ static int print_media_desc(const pjmedia_sdp_media *m, char *buf, pj_size_t len
733733
pj_memcpy(p, m->desc.transport.ptr, m->desc.transport.slen);
734734
p += m->desc.transport.slen;
735735
for (i=0; i<m->desc.fmt_count; ++i) {
736-
*p++ = ' ';
737-
pj_memcpy(p, m->desc.fmt[i].ptr, m->desc.fmt[i].slen);
738-
p += m->desc.fmt[i].slen;
736+
if (end-p > m->desc.fmt[i].slen) {
737+
*p++ = ' ';
738+
pj_memcpy(p, m->desc.fmt[i].ptr, m->desc.fmt[i].slen);
739+
p += m->desc.fmt[i].slen;
740+
} else {
741+
return -1;
742+
}
743+
}
744+
745+
if (end-p >= 2) {
746+
*p++ = '\r';
747+
*p++ = '\n';
748+
} else {
749+
return -1;
739750
}
740-
*p++ = '\r';
741-
*p++ = '\n';
742751

743752
/* print connection info, if present. */
744753
if (m->conn) {

0 commit comments

Comments
 (0)