summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Popelka <jpopelka@redhat.com>2011-06-08 18:56:12 +0200
committerJiri Popelka <jpopelka@redhat.com>2011-06-08 19:00:06 +0200
commit5d816a200c021a45641052cecc7a36f9f98eb561 (patch)
tree1bec609c59b1b07e776594ea577b51bc6d949b95
parent4476a3d338c3689137735345f26968a493af3f24 (diff)
downloadlibnet-5d816a200c021a45641052cecc7a36f9f98eb561.tar.gz
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".
-rw-r--r--libnet/src/libnet_cq.c4
-rw-r--r--libnet/src/libnet_init.c2
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)
{