Commit 3a5e449
bpf/helpers: bpf_strnstr: Exact match length
strnstr should not treat the ending '\0' of s2 as a matching character,
otherwise the parameter 'len' will be meaningless, 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.
Signed-off-by: Rong Tao <[email protected]>1 parent 83124e1 commit 3a5e449
1 file changed
+3
-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 | + | |
3679 | 3681 | | |
3680 | 3682 | | |
3681 | 3683 | | |
| |||
0 commit comments