Skip to content

Commit

Permalink
[nozzle] avoid tons of possible buffer overruns
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Jul 25, 2019
1 parent c6cc247 commit a2a0dfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libnozzle/internals.h
Expand Up @@ -34,7 +34,7 @@ struct nozzle_lib_config {
#define UPDOWN_PATH_MAX PATH_MAX - 11 - 1 - IFNAMSIZ

struct nozzle_iface {
char name[IFNAMSIZ]; /* interface name */
char name[IFNAMSIZ - 1]; /* interface name */
int fd; /* interface fd */
int up; /* interface status 0 is down, 1 is up */
/*
Expand Down
4 changes: 2 additions & 2 deletions libnozzle/libnozzle.c
Expand Up @@ -508,7 +508,7 @@ nozzle_t nozzle_open(char *devname, size_t devname_size, const char *updownpath)
goto out_error;
}
strncpy(devname, curnozzle, IFNAMSIZ);
strncpy(nozzle->name, curnozzle, IFNAMSIZ);
memmove(nozzle->name, curnozzle, IFNAMSIZ - 1);
#endif

#ifdef KNET_LINUX
Expand All @@ -532,7 +532,7 @@ nozzle_t nozzle_open(char *devname, size_t devname_size, const char *updownpath)
}

strncpy(devname, ifname, IFNAMSIZ);
strncpy(nozzle->name, ifname, IFNAMSIZ);
memmove(nozzle->name, ifname, IFNAMSIZ - 1);
#endif

nozzle->default_mtu = get_iface_mtu(nozzle);
Expand Down

0 comments on commit a2a0dfc

Please sign in to comment.