diff options
author | Thomas Osterried <ax25@x-berg.in-berlin.de> | 2022-05-02 02:21:01 +0200 |
---|---|---|
committer | Thomas Osterried <ax25@x-berg.in-berlin.de> | 2022-05-02 02:21:01 +0200 |
commit | a37aceea9ffbcbdc25819443905369a6f8cd395e (patch) | |
tree | bc5b295f400adedefcba11e342cd3d6b359fb1b8 | |
parent | 25619cc79e58a68bf88381a75ecdf93a9b8f9c90 (diff) | |
parent | 415b2d46a39302b21b51758e83f81e5439ab487c (diff) |
Merge branch 'master' of ssh://git.linux-ax25.org/pub/scm/libax25
-rw-r--r-- | COPYING.LIB (renamed from COPYING) | 0 | ||||
-rw-r--r-- | axconfig.c | 6 | ||||
-rw-r--r-- | libax25.spec.in | 2 | ||||
-rw-r--r-- | nrconfig.c | 4 | ||||
-rw-r--r-- | rsconfig.c | 3 | ||||
-rw-r--r-- | util.h | 12 |
6 files changed, 25 insertions, 2 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 { @@ -308,10 +310,12 @@ int ax25_config_load_ports(void) break; s = strchr(buffer, ':'); if (s) *s = 0; - s = buffer; + s = buffer; 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; diff --git a/libax25.spec.in b/libax25.spec.in index a77549a..5e8c789 100644 --- a/libax25.spec.in +++ b/libax25.spec.in @@ -53,7 +53,7 @@ rm -rf $RPM_BUILD_ROOT %postun -p /sbin/ldconfig %files -%doc AUTHORS ChangeLog COPYING README +%doc AUTHORS ChangeLog COPYING.LIB README %dir %{_sysconfdir}/ax25 %config(noreplace) %{_sysconfdir}/ax25/axports %config(noreplace) %{_sysconfdir}/ax25/nrports @@ -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 */ |