Message ID | 20240530150057.444585-6-hadess@hadess.net (mailing list archive) |
---|---|
State | Accepted |
Commit | 6cf9117bfd3f3b19cd6cfcf32910e29e57a4b1f7 |
Headers | show |
Series | Fix a number of static analysis issues #3 | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | fail | WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 9: B1 Line exceeds max length (107>80): "bluez-5.76/src/shared/mainloop-notify.c:132:2: tainted_data_argument: The value "si" is considered tainted." 10: B1 Line exceeds max length (107>80): "bluez-5.76/src/shared/mainloop-notify.c:137:3: tainted_data_argument: "si.ssi_signo" is considered tainted." 11: B1 Line exceeds max length (136>80): "bluez-5.76/src/shared/mainloop-notify.c:137:3: underflow: The cast of "si.ssi_signo" to a signed type could result in a negative number." 13: B3 Line contains hard tab characters (\t): "136| if (data && data->func)" 14: B3 Line contains hard tab characters (\t): "137|-> data->func(si.ssi_signo, data->user_data);" 16: B3 Line contains hard tab characters (\t): "139| return true;" |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
diff --git a/src/shared/mainloop-notify.c b/src/shared/mainloop-notify.c index 33be3cf8d78e..11989512e013 100644 --- a/src/shared/mainloop-notify.c +++ b/src/shared/mainloop-notify.c @@ -15,6 +15,7 @@ #define _GNU_SOURCE #include <stdio.h> #include <errno.h> +#include <limits.h> #include <unistd.h> #include <stdlib.h> #include <stddef.h> @@ -130,7 +131,7 @@ static bool signal_read(struct io *io, void *user_data) fd = io_get_fd(io); result = read(fd, &si, sizeof(si)); - if (result != sizeof(si)) + if (result != sizeof(si) || si.ssi_signo > INT_MAX) return false; if (data && data->func)