app/testpmd: fix potential out of bounds read
After the last enabled port has been seen, and the last time we evaluate the loop condition, there is an out of bounds read in ports[p].enabled because p is equal to size, which is the length of ports. Signed-off-by: Julien Cretin <julien.cretin@trust-in-soft.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit is contained in:
parent
42a0325632
commit
12a8e30fd7
@ -332,7 +332,7 @@ find_next_port(portid_t p, struct rte_port *ports, int size)
|
||||
if (ports == NULL)
|
||||
rte_exit(-EINVAL, "failed to find a next port id\n");
|
||||
|
||||
while ((ports[p].enabled == 0) && (p < size))
|
||||
while ((p < size) && (ports[p].enabled == 0))
|
||||
p++;
|
||||
return p;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user