Re: [Live-devel] Fix for a possible buffer overflow in SDESItem

2010-03-11 Thread Ross Finlayson
Thanks for bringing this to our attention. There are actually two bugs here: Bug 1: if (length > 511) length = 511; Each "511" should be "255" (duh!) Bug 2: // Pad the trailing bytes to a 4-byte boundary: while ((length)%4 > 0) fData[2 + length++] = '\0'; This code shouldn't be the

Re: [Live-devel] Fix for a possible buffer overflow in SDESItem

2010-03-11 Thread Jeremy Noring
On Thu, Mar 11, 2010 at 9:16 AM, Doug Porter wrote: > Jeremy Noring writes: > > > > Actually, on second glance, the only realistic option is to > > shorten length, because only a single byte is allotted to the > > size field in fData[1]. (note that length is cast to unsigned > > char). So in R

Re: [Live-devel] Fix for a possible buffer overflow in SDESItem

2010-03-11 Thread Doug Porter
Jeremy Noring writes: > > Actually, on second glance, the only realistic option is to > shorten length, because only a single byte is allotted to the > size field in fData[1]. (note that length is cast to unsigned > char). So in RTCP.cpp, I'd change this line: > > if (length > 251) length = 25

Re: [Live-devel] Fix for a possible buffer overflow in SDESItem

2010-03-11 Thread Jeremy Noring
On Thu, Mar 11, 2010 at 8:43 AM, Jeremy Noring wrote: > In RTCP.cpp, > > SDESItem::SDESItem(unsigned char tag, unsigned char const* value) { > unsigned length = strlen((char const*)value); > if (length > 511) length = 511; > > fData[0] = tag; > fData[1] = (unsigned char)length; > memmov

[Live-devel] Fix for a possible buffer overflow in SDESItem

2010-03-11 Thread Jeremy Noring
In RTCP.cpp, SDESItem::SDESItem(unsigned char tag, unsigned char const* value) { unsigned length = strlen((char const*)value); if (length > 511) length = 511; fData[0] = tag; fData[1] = (unsigned char)length; memmove(&fData[2], value, length); // Pad the trailing bytes to a 4-byte bo