Skip to content

Commit

Permalink
strings.h
Browse files Browse the repository at this point in the history
  • Loading branch information
hrbrmstr committed Apr 17, 2018
1 parent 6769a39 commit 6535edc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ extern "C" {

#include "common.h"

#include <string.h>

#include "alloc.h"
#include "attr.h"
#include "tnef_types.h"
Expand Down Expand Up @@ -193,7 +195,7 @@ attr_free (Attr* attr)
}
}



/* Validate the checksum against attr. The checksum is the sum of all the
bytes in the attribute data modulo 65536 */
static int
Expand Down Expand Up @@ -237,21 +239,21 @@ attr_read (FILE* in)
uint16 checksum;

Attr *attr = CHECKED_XCALLOC (Attr, 1);

attr->lvl_type = geti8(in);

assert ((attr->lvl_type == LVL_MESSAGE)
|| (attr->lvl_type == LVL_ATTACHMENT));

type_and_name = geti32(in);

attr->type = (type_and_name >> 16);
attr->name = ((type_and_name << 16) >> 16);
attr->len = geti32(in);
attr->buf = CHECKED_XCALLOC (unsigned char, attr->len);

(void)getbuf(in, attr->buf, attr->len);

checksum = geti16(in);
if (!check_checksum(attr, checksum))
{
Expand All @@ -267,7 +269,7 @@ attr_read (FILE* in)
exit( 1 );
}
}

if (DEBUG_ON) attr_dump (attr);

return attr;
Expand Down

0 comments on commit 6535edc

Please sign in to comment.