fixes bug 301643 "Off-by-one in mar_consume_index" r+a=bsmedberg

git-svn-id: svn://10.0.0.236/trunk@176812 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net
2005-07-28 22:19:37 +00:00
parent 37b383d59a
commit 2cf2c14337

View File

@@ -102,7 +102,7 @@ static int mar_consume_index(MarFile *mar, char **buf, const char *buf_end) {
* PRUint32 offset (network byte order)
* PRUint32 length (network byte order)
* PRUint32 flags (network byte order)
* char name[N]
* char name[N] (where N >= 1)
* char null_byte;
*/
PRUint32 offset;
@@ -111,7 +111,7 @@ static int mar_consume_index(MarFile *mar, char **buf, const char *buf_end) {
const char *name;
int namelen;
if ((buf_end - *buf) < (int)(2*sizeof(PRUint32) + 2))
if ((buf_end - *buf) < (int)(3*sizeof(PRUint32) + 2))
return -1;
memcpy(&offset, *buf, sizeof(offset));