Commit 30f1928d authored by rswindell's avatar rswindell
Browse files

Fix for crc32() and crc16(), don't run strlen() on a NULL pointer.

parent 327caf4a
......@@ -78,7 +78,7 @@ unsigned short crc16(char* data, unsigned long len)
unsigned short crc = 0;
unsigned long l;
if(len==0)
if(len==0 && buf!=NULL)
len=strlen(data);
for(l=0;l<len;l++)
crc = ucrc16(data[l],crc);
......
......@@ -82,7 +82,7 @@ unsigned long crc32(char *buf, unsigned long len)
{
unsigned long l,crc=0xffffffff;
if(len==0)
if(len==0 && buf!=NULL)
len=strlen(buf);
for(l=0;l<len;l++)
crc=ucrc32(buf[l],crc);
......
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