Commit b9aec34d authored by Sasha Goldshtein's avatar Sasha Goldshtein

trace: Generated streq-helper to ignore null terminator

parent fd44cd24
...@@ -217,11 +217,11 @@ class Probe(object): ...@@ -217,11 +217,11 @@ class Probe(object):
fname = "streq_%d" % Probe.streq_index fname = "streq_%d" % Probe.streq_index
Probe.streq_index += 1 Probe.streq_index += 1
self.streq_functions += """ self.streq_functions += """
static inline bool %s(char const *ignored, unsigned long str) { static inline bool %s(char const *ignored, uintptr_t str) {
char needle[] = %s; char needle[] = %s;
char haystack[sizeof(needle)]; char haystack[sizeof(needle)];
bpf_probe_read(&haystack, sizeof(haystack), (void *)str); 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]) { if (needle[i] != haystack[i]) {
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment