diff mbox series

fectest.c: fix buffer overrun

Message ID 20211202144518.3133036-1-ralph.siemsen@linaro.org
State Accepted
Commit 5a71d0079629a3a81ab52ff2c05e13380946c369
Headers show
Series fectest.c: fix buffer overrun | expand

Commit Message

Ralph Siemsen Dec. 2, 2021, 2:45 p.m. UTC
misc-utils/fectest.c:37:11: warning: iteration 47 invokes undefined behavior [-Waggressive-loop-optimizations]
   37 |   srcs[i] = buf + (i * PKT_SIZE);
      |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
---
 misc-utils/fectest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Oberhollenzer Dec. 6, 2021, 12:50 a.m. UTC | #1
Applied to mtd-utils.git master.

Thanks,

David
diff mbox series

Patch

diff --git a/misc-utils/fectest.c b/misc-utils/fectest.c
index fcba513..eb1d33e 100644
--- a/misc-utils/fectest.c
+++ b/misc-utils/fectest.c
@@ -21,7 +21,7 @@  int main(void)
 	unsigned char buf[NR_PKTS * PKT_SIZE];
 	unsigned char pktbuf[(NR_PKTS + DROPS) * PKT_SIZE];
 	struct fec_parms *fec;
-	unsigned char *srcs[NR_PKTS];
+	unsigned char *srcs[NR_PKTS + DROPS];
 	unsigned char *pkt[NR_PKTS + DROPS];
 	int pktnr[NR_PKTS + DROPS];
 	struct timeval then, now;