Commit 9e349c1d authored by Ron's avatar Ron Committed by Tristan Matthews

Check the size of the header packet before we look inside it

Signed-off-by: default avatarTristan Matthews <le.businessman@gmail.com>
parent ca7cfdbf
......@@ -147,20 +147,22 @@ EXPORT SpeexHeader *speex_packet_to_header(char *packet, int size)
int i;
SpeexHeader *le_header;
const char *h = "Speex ";
for (i=0;i<8;i++)
if (packet[i]!=h[i])
{
speex_notify("This doesn't look like a Speex file");
return NULL;
}
/*FIXME: Do we allow larger headers?*/
if (size < (int)sizeof(SpeexHeader))
{
speex_notify("Speex header too small");
return NULL;
}
for (i=0;i<8;i++)
if (packet[i]!=h[i])
{
speex_notify("This doesn't look like a Speex file");
return NULL;
}
le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
SPEEX_COPY(le_header, (SpeexHeader*)packet, 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment