Bug #987
openIncomplete string comparison pattern
0%
Description
In a few instances in lttng-tools, a string comparison pattern involving strncmp and strlen() to limit the length of the comparison is used.
One can quickly find them with:
grep -r -A 3 strncmp . | less -> search for strlen or strnlen
Many of those are OK: they indeed only want to match the beginning of the strings. However, this pattern is incorrectly used in cases where a full match is required, for instance:
ust-registry.c:ht_match_event()
./src/bin/lttng/commands/enable_channels.c: if (!strncmp(output_mmap, opt_output, strlen(output_mmap))) {
./src/bin/lttng/commands/enable_channels.c: } else if (!strncmp(output_splice, opt_output, strlen(output_splice))) {
./src/bin/lttng-sessiond/snapshot.c: if (!strncmp(output->name, name, strlen(name))) {
Updated by Jérémie Galarneau over 8 years ago
- Status changed from New to Confirmed
Updated by Jérémie Galarneau over 8 years ago
- Target version changed from 2.8 to 2.9