* src/sum.c (output_bsd): On sparc64 for example,
a crc of 0 was output due to casting an int variable
to uint16_t and thus operating on the wrong end of the variable.
Instead use explicit assignment to the narrower type
to ensure we get the appropriate data.
(output_sysv): Likewise.
Reported by Bruno Haible.
if (raw)
{
/* Output in network byte order (big endian). */
- uint16_t out_int = SWAP (*(uint16_t *)digest);
+ uint16_t out_int = *(int *)digest;
+ out_int = SWAP (out_int);
fwrite (&out_int, 1, 16/8, stdout);
return;
}
if (raw)
{
/* Output in network byte order (big endian). */
- uint16_t out_int = SWAP (*(uint16_t *)digest);
+ uint16_t out_int = *(int *)digest;
+ out_int = SWAP (out_int);
fwrite (&out_int, 1, 16/8, stdout);
return;
}