Skip to contentSkip to conversation

app/testpmd: fix random flow item token

PATCH New Gregory Etelson 1 participant 1 message May 19, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix random flow item token

ITEM_RANDOM_VALUE token initializes 32 bits mask argument value from a constant source buffer.

Testpmd initiated the mast value from the 3 bytes buffer - [0xff, 0xff, 0x00].
When testpmd copied that value to 32 bits mask it accessed a memory byte outside the source buffer.

The patch fixes the source buffer size.

Fixes 738ef8f7c706 ("ethdev: add flow item for random matching")
---
 app/test-pmd/cmdline_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/cmdline_flow.c +1 -1
index 998527590f..fc807ad8cf 100644
@@ -5591,7 +5591,7 @@ static const struct token token_list[] = {
 		.next = NEXT(item_random, NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_MASK(struct rte_flow_item_random,
-					     value, "\xff\xff")),
+					     value, "\x00\x00\xff\xff")),
 	},
 	[ITEM_GRE_KEY] = {
 		.name = "gre_key",
Signature · 1 line
2.48.1