Skip to content

Commit

Permalink
resolves #47: invalid write in TNEFFillMapi
Browse files Browse the repository at this point in the history
Don't pass 0 to calloc
  • Loading branch information
ohwgiles committed May 30, 2018
1 parent 3fa03bb commit c576639
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ytnef.c
Expand Up @@ -479,6 +479,10 @@ int TNEFFillMapi(TNEFStruct *TNEF, BYTE *data, DWORD size, MAPIProps *p) {
d += 4;
count = 0;
}
if (mp->count == 0) {
printf("ERROR: count==0 when filling MAPI property\n");
return -1;
}
mp->data = calloc(mp->count, sizeof(variableLength));
ALLOCCHECK(mp->data);
vl = mp->data;
Expand Down

0 comments on commit c576639

Please sign in to comment.