When we match a key in is_valid_key() and rte_kvargs_process(), do a
strict comparison (strcmp()) instead of using strstr(s1, s2) which tries
a find s1 in s2. This old behavior could lead to unexpected match, for
instance "cola" match "chocolate".
Surprisingly, no patch was needed on rte_kvargs_count() as it already
used strcmp().
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
{
const char **valid_ptr;
- for (valid_ptr = valid; *valid_ptr != NULL; valid_ptr++)
- if (strstr(key_match, *valid_ptr) != NULL)
+ for (valid_ptr = valid; *valid_ptr != NULL; valid_ptr++) {
+ if (strcmp(key_match, *valid_ptr) == 0)
return 1;
+ }
return 0;
}
for (i = 0; i < kvlist->count; i++) {
pair = &kvlist->pairs[i];
- if (strstr(pair->key, key_match) != NULL) {
+ if (strcmp(pair->key, key_match) == 0) {
if ((*handler)(pair->value, opaque_arg) < 0)
return -1;
}