Page MenuHomeFreeBSD

xdr: store chars consistently
ClosedPublic

Authored by brooks on Jan 9 2023, 7:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 8:13 PM
Unknown Object (File)
Oct 17 2024, 10:34 AM
Unknown Object (File)
Oct 16 2024, 4:24 PM
Unknown Object (File)
Sep 24 2024, 9:53 AM
Unknown Object (File)
Sep 20 2024, 2:23 PM
Unknown Object (File)
Sep 17 2024, 9:57 PM
Unknown Object (File)
Sep 17 2024, 8:33 PM
Unknown Object (File)
Sep 17 2024, 5:57 PM
Subscribers

Details

Summary

Cast char's through unsigned char before storing as an integer in
xdr_char(), this ensures that the encoded form is consistently not
sign-extended following Open Solaris's example.

Prior to this change, platforms with signed chars would sign extend
values with the high bit set but ones without unsigned chars would not
so 0xff would be stored as 0x000000ff on unsigned char platforms and
0xffffffff on signed char platforms. Decoding has the same
result for either form so this is a largely cosmetic change, but it
seems best to produce consistent output.

For more discussion, see https://github.com/openzfs/zfs/issues/14173

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable