-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Description
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:
Line 162 in caca81d
| int pid,cmd=1; |
If
-r argument is found, the value of cmd is incrementedLines 173 to 175 in caca81d
| if (strcmp(argv[cmd], "-r") == 0) { | |
| threat = 1; | |
| cmd++; |
Next access to the
argv[cmd] element without checking its presenceLine 182 in caca81d
| 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels