incorrect crc32 comparisons
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
vde2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
cryptcab decided to treat crc32 values as a string for some reason. In doing so, it incorrectly compares two crc32 values:
int
isvalid_
{
unsigned char *crc=(unsigned char *)crc32(
}else{
}
}
strcmp will stop reading at the first 0x00 character ('\0') in the string, whether it is intentional or not. Further characters are not compared.
If the string implementation is desirable, then this code should switch to memcmp(3), and a specified length of '4'.
However, this entire string-based comparison could probably be replaced if the crc32() were redesigned to use htonl(3) to manipulate the crc32 values as a single four-byte entity. These can be compared using == directly and without invoking malloc(3) and free(3). However, I have not tested that htonl(3) is an accurate replacement, so please be sure to test this thoroughly. (The existing code may actually be incorrect on PowerPC, SPARC, MIPS, etc. I also haven't tested this guess.)
https:/ /sourceforge. net/tracker/ ?func=detail& aid=3603901& group_id= 95403&atid= 611248