Problem: In some places, we do the comparison between signed and unsigned integers. To avoid compiler warnings we cast the signed type to an unsigned type (just like the compiler would do implicitly without the checks). This can be very harmful if the signed variable is negative.
The following files might have this error (grep -R "(ssize_t)" | less):
Issue by lerwys Monday Jan 12, 2015 at 10:47 GMT Originally opened as https://github.com/lnls-dig/bpm-sw/issues/67
Problem: In some places, we do the comparison between signed and unsigned integers. To avoid compiler warnings we cast the signed type to an unsigned type (just like the compiler would do implicitly without the checks). This can be very harmful if the signed variable is negative.
The following files might have this error (grep -R "(ssize_t)" | less):
hal/msg/smio_thsafe_ops/smio_thsafe_zmq_client.c hal/sm_io/chips/sm_ch_24aa64.c hal/sm_io/chips/sm_ch_si57x.c hal/sm_io/protocols/ops/sm_pr_spi.c
Solution: A generic solution could be something like the following:
errs >= 0 && (size_t) errs < sizeof (hostname)