Hi
A bug was found in the autrace utility when the -r parameter is passed, but its value is omitted.
At the beginning, cmd is initialized by 1:
If
-r argument is found, the value of
cmd is incremented
|
if (strcmp(argv[cmd], "-r") == 0) { |
|
threat = 1; |
|
cmd++; |
Next access to the
argv[cmd] element without checking its presence
|
if (access(argv[cmd], X_OK)) { |
Steps to reproduce:
- build with UBSAN (
-fsanitize=undefined)
- run
autrace -r
autrace.c:182:13: runtime error: null pointer passed as argument 1, which is declared to never be null
/usr/include/unistd.h:287:60: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior autrace.c:182:13 in
Error checking (null) (Bad address)
Bug was found with Svace static analyzer
Hi
A bug was found in the
autraceutility when the-rparameter is passed, but its value is omitted.At the beginning,
cmdis initialized by 1:audit-userspace/src/autrace.c
Line 162 in caca81d
If
-rargument is found, the value ofcmdis incrementedaudit-userspace/src/autrace.c
Lines 173 to 175 in caca81d
Next access to the
argv[cmd]element without checking its presenceaudit-userspace/src/autrace.c
Line 182 in caca81d
Steps to reproduce:
-fsanitize=undefined)autrace -rBug was found with Svace static analyzer