Skip to content

Commit

Permalink
app/testpmd: avoid potential outside of array reference
Browse files Browse the repository at this point in the history
[ upstream commit f86085c ]

The order of comparison is wrong, and potentially allows
referencing past the array.

Link: https://pvs-studio.com/en/blog/posts/cpp/1179/
Fixes: 3e3edab ("ethdev: add flow quota")

Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
Acked-by: Chengwen Feng <[email protected]>
  • Loading branch information
shemminger authored and steevenlee committed Dec 6, 2024
1 parent 1fb0641 commit 747ba36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/test-pmd/cmdline_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -12111,7 +12111,7 @@ comp_names_to_index(struct context *ctx, const struct token *token,
RTE_SET_USED(token);
if (!buf)
return names_size;
if (names[ent] && ent < names_size)
if (ent < names_size && names[ent] != NULL)
return rte_strscpy(buf, names[ent], size);
return -1;

Expand Down

0 comments on commit 747ba36

Please sign in to comment.