diff options
-rw-r--r-- | axconfig.c | 4 | ||||
-rw-r--r-- | nrconfig.c | 4 | ||||
-rw-r--r-- | rsconfig.c | 3 | ||||
-rw-r--r-- | util.h | 12 |
4 files changed, 23 insertions, 0 deletions
@@ -15,7 +15,9 @@ #include <netax25/axconfig.h> #include <netax25/axlib.h> #include <netrose/rose.h> + #include "pathnames.h" +#include "util.h" typedef struct _axport { @@ -312,6 +314,8 @@ int ax25_config_load_ports(void) while (isspace(*s & 0xff)) ++s; memset(&ifr, 0, sizeof(ifr)); + if (strlen(s) >= IFNAMSIZ) + unreachable(); strncpy(ifr.ifr_name, s, IFNAMSIZ-1); ifr.ifr_name[IFNAMSIZ-1] = 0; @@ -18,6 +18,8 @@ #include <netax25/axlib.h> #include <netax25/nrconfig.h> +#include "util.h" + typedef struct _nrport { struct _nrport *Next; @@ -291,6 +293,8 @@ int nr_config_load_ports(void) while (isspace(*s & 0xff)) ++s; memset(&ifr, 0, sizeof(ifr)); + if (strlen(s) >= IFNAMSIZ) + unreachable(); strncpy(ifr.ifr_name, s, IFNAMSIZ-1); ifr.ifr_name[IFNAMSIZ-1] = 0; @@ -18,6 +18,7 @@ #include <netax25/rsconfig.h> #include "pathnames.h" +#include "util.h" typedef struct _rsport { @@ -237,6 +238,8 @@ int rs_config_load_ports(void) while (isspace(*s & 0xff)) ++s; memset(&ifr, 0, sizeof(ifr)); + if (strlen(s) >= IFNAMSIZ) + unreachable(); strncpy(ifr.ifr_name, s, IFNAMSIZ-1); ifr.ifr_name[IFNAMSIZ-1] = 0; @@ -0,0 +1,12 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __LIBAX25_UTIL_H +#define __LIBAX25_UTIL_H + +#define unreachable() \ + do { __builtin_unreachable(); } while (0) + +#endif /* __LIBAX25_UTIL_H */ |