Commit 0d6a2a4
libbpf: Fix out-of-bound read
BugLink: https://bugs.launchpad.net/bugs/2115678
[ Upstream commit 236d3910117e9f97ebf75e511d8bcc950f1a4e5f ]
In `set_kcfg_value_str`, an untrusted string is accessed with the assumption
that it will be at least two characters long due to the presence of checks for
opening and closing quotes. But the check for the closing quote
(value[len - 1] != '"') misses the fact that it could be checking the opening
quote itself in case of an invalid input that consists of just the opening
quote.
This commit adds an explicit check to make sure the string is at least two
characters long.
Signed-off-by: Nandakumar Edamana <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Manuel Diewald <[email protected]>
Signed-off-by: Mehmet Basaran <[email protected]>1 parent d4e470f commit 0d6a2a4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2106 | 2106 | | |
2107 | 2107 | | |
2108 | 2108 | | |
2109 | | - | |
| 2109 | + | |
2110 | 2110 | | |
2111 | 2111 | | |
2112 | 2112 | | |
| |||
0 commit comments