From 5d816a200c021a45641052cecc7a36f9f98eb561 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Wed, 8 Jun 2011 18:56:12 +0200 Subject: Coverity: OVERRUN_STATIC libnet_init.c:74: overrun-local: Overrunning static array "l->label", with 64 elements, at position 64 with index variable "sizeof (l->label) /*64*/" libnet_cq.c:119: overrun-local: Overrunning static array "l->label", with 64 elements, at position 64 with index variable "64" libnet_cq.c:150: overrun-local: Overrunning static array "l->label", with 64 elements, at position 64 with index variable "64". --- libnet/src/libnet_cq.c | 4 ++-- libnet/src/libnet_init.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libnet/src/libnet_cq.c b/libnet/src/libnet_cq.c index d64a22f..ad0b6ae 100644 --- a/libnet/src/libnet_cq.c +++ b/libnet/src/libnet_cq.c @@ -116,7 +116,7 @@ libnet_cq_add(libnet_t *l, char *label) /* label the context with the user specified string */ strncpy(l->label, label, LIBNET_LABEL_SIZE); - l->label[LIBNET_LABEL_SIZE] = '\0'; + l->label[LIBNET_LABEL_SIZE - 1] = '\0'; l_cq->next = NULL; l_cq->prev = NULL; @@ -147,7 +147,7 @@ libnet_cq_add(libnet_t *l, char *label) /* label the context with the user specified string */ strncpy(l->label, label, LIBNET_LABEL_SIZE); - l->label[LIBNET_LABEL_SIZE] = '\0'; + l->label[LIBNET_LABEL_SIZE -1] = '\0'; new->next = l_cq; new->prev = NULL; diff --git a/libnet/src/libnet_init.c b/libnet/src/libnet_init.c index 5cc1577..7974f6c 100644 --- a/libnet/src/libnet_init.c +++ b/libnet/src/libnet_init.c @@ -71,7 +71,7 @@ libnet_init(int injection_type, const char *device, char *err_buf) l->fd = -1; strncpy(l->label, LIBNET_LABEL_DEFAULT, LIBNET_LABEL_SIZE); - l->label[sizeof(l->label)] = '\0'; + l->label[LIBNET_LABEL_SIZE - 1] = '\0'; switch (l->injection_type) { -- cgit v1.2.1