Skip to content

Commit

Permalink
[nozzle] expand buffers to deal with strncpy and -Werror=stringop-tru…
Browse files Browse the repository at this point in the history
…ncatio

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Dec 15, 2018
1 parent 1b0613e commit 904ef83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libnozzle/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ struct nozzle_lib_config {
#define PREFIX_CHAR_MAX 4

struct nozzle_ip {
char ipaddr[IPADDR_CHAR_MAX];
char prefix[PREFIX_CHAR_MAX];
char ipaddr[IPADDR_CHAR_MAX + 1];
char prefix[PREFIX_CHAR_MAX + 1];
int domain; /* AF_INET or AF_INET6 */
struct nozzle_ip *next;
};
Expand All @@ -47,7 +47,7 @@ struct nozzle_iface {
/*
* default MAC address assigned by the kernel at creation time
*/
char default_mac[MACADDR_CHAR_MAX];
char default_mac[MACADDR_CHAR_MAX + 1];

int default_mtu; /* MTU assigned by the kernel at creation time */
int current_mtu; /* MTU configured by libnozzle user */
Expand Down
2 changes: 1 addition & 1 deletion libnozzle/libnozzle.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ nozzle_t nozzle_open(char *devname, size_t devname_size, const char *updownpath)
}

memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifname, devname, IFNAMSIZ);
memmove(ifname, devname, IFNAMSIZ);
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;

if (ioctl(nozzle->fd, TUNSETIFF, &ifr) < 0) {
Expand Down

0 comments on commit 904ef83

Please sign in to comment.