Skip to content
Snippets Groups Projects
Commit 93b19fdf authored by Hallvard Furuseth's avatar Hallvard Furuseth
Browse files

Fix bdb_db_hash() to handle padding bits in integers.

parent 6fab51e3
No related branches found
No related tags found
No related merge requests found
......@@ -29,17 +29,13 @@ bdb_db_hash(
u_int32_t length
)
{
u_int32_t ret = 0;
unsigned char *dst = (unsigned char *)&ret;
const unsigned char *src = (const unsigned char *)bytes;
u_int32_t i, ret = 0;
if ( length > sizeof(u_int32_t) )
length = sizeof(u_int32_t);
while ( length ) {
*dst++ = *src++;
length--;
}
for( i = 0; i < length; i++ )
ret = (ret << 8) + ((const unsigned char *)bytes)[i];
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment