--- libnet/src/libnet_cq.c +++ libnet/src/libnet_cq.c @@ -113,8 +113,8 @@ libnet_cq_add(libnet_t *l, char *label) l_cq->context = l; /* label the context with the user specified string */ - strncpy(l->label, label, LIBNET_LABEL_SIZE); - l->label[LIBNET_LABEL_SIZE] = '\0'; + l->label[0] = '\0'; + strncat(l->label, label, LIBNET_LABEL_SIZE - 1); l_cq->next = NULL; l_cq->prev = NULL; @@ -144,8 +144,8 @@ libnet_cq_add(libnet_t *l, char *label) new->context = l; /* label the context with the user specified string */ - strncpy(l->label, label, LIBNET_LABEL_SIZE); - l->label[LIBNET_LABEL_SIZE] = '\0'; + l->label[0] = '\0'; + strncat(l->label, label, LIBNET_LABEL_SIZE - 1); new->next = l_cq; new->prev = NULL; --- libnet/src/libnet_init.c +++ libnet/src/libnet_init.c @@ -76,8 +76,8 @@ libnet_init(int injection_type, char *device, char *err_buf) l->ptag_state = LIBNET_PTAG_INITIALIZER; l->device = (device ? strdup(device) : NULL); - strncpy(l->label, LIBNET_LABEL_DEFAULT, LIBNET_LABEL_SIZE); - l->label[sizeof(l->label)] = '\0'; + l->label[0] = '\0'; + strncat(l->label, LIBNET_LABEL_DEFAULT, LIBNET_LABEL_SIZE - 1); switch (l->injection_type) {