Commit 6541c66
bpf/helpers: bpf_strnstr: Exact match length
strnstr should not treat the ending '\0' of s2 as a matching character
if the parameter 'len' equal to s2 string length, for example:
1. bpf_strnstr("openat", "open", 4) = -ENOENT
2. bpf_strnstr("openat", "open", 5) = 0
This patch makes (1) return 0, indicating a successful match.
Fixes: e913705 ("bpf: Add kfuncs for read-only string operations")
Signed-off-by: Rong Tao <[email protected]>1 parent 27199db commit 6541c66
1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3672 | 3672 | | |
3673 | 3673 | | |
3674 | 3674 | | |
3675 | | - | |
| 3675 | + | |
3676 | 3676 | | |
3677 | 3677 | | |
3678 | 3678 | | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
3679 | 3687 | | |
3680 | 3688 | | |
3681 | 3689 | | |
| |||
0 commit comments