Commit 6ab1332
committed
Fix out-of-bounds string manipulation causing segfault.
If registerForEvents() is called with "libredfish" for the postbackUri
parameter, the function accepts this string and passes a pointer to
'postbackUri+11' to getDestinationAddress. In this case, the pointer actually
points past the end of the string's null byte.
On CHERI architectures, such as ARM Morello, pointer bounds are enforced in
hardware and attempting to dereference the pointer passed to
getDestinationAddress() causes a segfault.
Valid values for postbackUri should include a colon after "libredfish",
checking for this as part of the strncmp call rejects the invalid string
"libredfish" and this also means that getDestinationAddress() is not passed
an invalid pointer. This prevents a segfault on CHERI and prevents undefined
behavior on other architectures.
Signed-off-by: Michael Cobb <[email protected]>1 parent 1795647 commit 6ab1332
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
932 | 932 | | |
933 | 933 | | |
934 | 934 | | |
935 | | - | |
| 935 | + | |
936 | 936 | | |
937 | 937 | | |
938 | 938 | | |
| |||
0 commit comments