diff options
-rw-r--r-- | libnet/src/libnet_cq.c | 4 | ||||
-rw-r--r-- | 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) { |