HomeFreeBSD

Fix truncation when ssize_t is larger than MAX_INT

Description

Fix truncation when ssize_t is larger than MAX_INT

Casting to int truncates size on some platforms, resulting swab not
copying all the data. Cast len to size_t to avoid right shifting a
signed value: we know here it's > 0, so we can safely cast it w/o losing
precision.

In addition, be more careful with signedness of char pointers and
temporaries. Downgrade tmp from unsigned long to unsigned char since
we're only reading and writing characters.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/516

Details

Provenance
gfunni234_gmail.comAuthored on Jul 24 2021, 4:52 PM
impCommitted on Feb 5 2023, 4:14 AM
Parents
rG0cec5b99b3c0: usb/u3g: Add support for QUECTEL EP06-E 4G modem
Branches
Unknown
Tags
Unknown