argdist: Generated streq-helper to ignore null terminator
Oftentimes we want to use the STRCMP helper to compare strings that
are not null-terminated, e.g. in USDT probes this often happens.
Ignore the null terminator (i.e. loop until the last character
excluding the null terminator).
@@ -258,7 +258,7 @@ static inline bool %s(char const *ignored, char const *str) {
char needle[] = %s;
char haystack[sizeof(needle)];
bpf_probe_read(&haystack, sizeof(haystack), (void *)str);
- for (int i = 0; i < sizeof(needle); ++i) {
+ for (int i = 0; i < sizeof(needle)-1; ++i) {
if (needle[i] != haystack[i]) {
return false;
}
