Commit c71c434
committed
dp-hw.c: fix incorrect error handling of efidp_node_size() invocations
One of our analysis tools noticed the following error:
Error: OVERRUN (CWE-119):
efivar-38/src/dp-hw.c:64: return_constant: Function call "efidp_node_size(dp)" may return -1.
efivar-38/src/dp-hw.c:64: overrun-buffer-arg: Calling "format_hex_helper" with "(uint8_t *)dp + 4" and "efidp_node_size(dp) - 4L" is suspicious because of the very large index, 18446744073709551611. The index may be due to a negative parameter being interpreted as unsigned.
# 62| format(buf, size, off, "Hardware",
# 63| "HardwarePath(%d,", dp->subtype);
# 64|-> format_hex(buf, size, off, "Hardware", (uint8_t *)dp+4,
# 65| efidp_node_size(dp)-4);
# 66| format(buf, size, off, "Hardware", ")");
This patch adds error checking to that use of efidp_node_size().
Resolves: RHEL-27676
Signed-off-by: Peter Jones <[email protected]>1 parent 72b3093 commit c71c434
1 file changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
62 | 69 | | |
63 | 70 | | |
64 | | - | |
65 | | - | |
| 71 | + | |
66 | 72 | | |
67 | 73 | | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
0 commit comments