Commit Graph
5 Commits
Author SHA1 Message Date
weichslgartner da0326ffc6 fix for issue #369
adding cast preventing int/unsigned comparison (-Wsign-compare warning in lib.c)
2022-06-30 18:40:07 +02:00
weichslgartner ef853f5553 added return value check of snprintf to prevent possible buffer overflows detected by CodeQL 2022-06-20 19:22:11 +02:00
weichslgartner eb2b38790a fixes undefined behavior in parse_canframe (lib.c:187) by chaning tmp to
canid_t

Issue:
mkdir build && cd build
CC=clang cmake -DCMAKE_C_FLAGS="-fsanitize=address,undefined"
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined" .. && cmake
--build .

 echo "(0.0) can1 ffffffff#00000000" | ./log2long
can-utils/lib.c:187:23: runtime error: left shift of 15 by 28 places
cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/can-utils/lib.c:187:23 in
(0.0)  can1  3FFFFFFF
2022-06-20 19:11:00 +02:00
weichslgartner 34732eddeb fixed signed integer overflow in asc2log.c:100
Issue:
echo "0.0000 0  Rx   d 8 8D 00 10 01 00 82 01 00
      0.200000000000000000 0- 0000  Rx   d 8 8D 00 10 01 00 82 01 00" |
./asc2log

can-utils/asc2log.c:100:20: runtime error: signed integer overflow:
200000000000000000 * 100 cannot be represented in type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior asc2log.c:100:20
2022-06-13 17:42:33 +02:00
weichslgartner 2b0ef5c330 Create codeql-analysis.yml 2022-06-13 17:42:33 +02:00