Project

General

Profile

Actions

Bug #987

open

Incomplete string comparison pattern

Added by Mathieu Desnoyers about 8 years ago. Updated almost 8 years ago.

Status:
Confirmed
Priority:
Normal
Target version:
Start date:
01/06/2016
Due date:
% Done:

0%

Estimated time:

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))) {

Actions #1

Updated by Jérémie Galarneau almost 8 years ago

  • Target version set to 2.8
Actions #2

Updated by Jérémie Galarneau almost 8 years ago

  • Status changed from New to Confirmed
Actions #3

Updated by Jérémie Galarneau almost 8 years ago

  • Target version changed from 2.8 to 2.9
Actions

Also available in: Atom PDF