From a0f55e4e0e9884ec454e413732f8e8455febed11 Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 10 Apr 2019 23:19:26 +0200
Subject: [PATCH 01/14] COPYING: Update license from FSF source.

The checked in version is an unchanged version of the file obtained from
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.  Aside from minor
whitespace changes it fixes the FSF's address which has changed many years
ago plus an oversight in the instructions on how to apply the terms to
other code which are not part of the actual licensing terms which are
staying unchanged.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 COPYING | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/COPYING b/COPYING
index b8df7fd..4362b49 100644
--- a/COPYING
+++ b/COPYING
@@ -1,8 +1,8 @@
-		  GNU LESSER GENERAL PUBLIC LICENSE
-		       Version 2.1, February 1999
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
 
  Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -10,7 +10,7 @@
  as the successor of the GNU Library Public License, version 2, hence
  the version number 2.1.]
 
-			    Preamble
+                            Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
@@ -112,7 +112,7 @@ modification follow.  Pay close attention to the difference between a
 former contains code derived from the library, whereas the latter must
 be combined with the library in order to run.
 
-		  GNU LESSER GENERAL PUBLIC LICENSE
+                  GNU LESSER GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License Agreement applies to any software library or other
@@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
 of all derivatives of our free software and of promoting the sharing
 and reuse of software generally.
 
-			    NO WARRANTY
+                            NO WARRANTY
 
   15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -455,9 +455,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGES.
 
-		     END OF TERMS AND CONDITIONS
+                     END OF TERMS AND CONDITIONS
 
-	   How to Apply These Terms to Your New Libraries
+           How to Apply These Terms to Your New Libraries
 
   If you develop a new library, and you want it to be of the greatest
 possible use to the public, we recommend making it free software that
@@ -476,7 +476,7 @@ convey the exclusion of warranty; and each file should have at least the
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
+    version 2.1 of the License, or (at your option) any later version.
 
     This library is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the
 
     You should have received a copy of the GNU Lesser General Public
     License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 Also add information on how to contact you by electronic and paper mail.
 
-- 
2.41.0


From ccfd3f39189975fcc8699eee6c1c51733ffe3777 Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 11 Apr 2019 00:56:00 +0200
Subject: [PATCH 02/14] treewide: Update all references to the FSF's address.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 netax25/ax25.h      | 5 ++---
 netax25/ax25io.h    | 7 +++----
 netax25/axconfig.h  | 7 +++----
 netax25/axlib.h     | 7 +++----
 netax25/daemon.h    | 7 +++----
 netax25/mheard.h    | 7 +++----
 netax25/nrconfig.h  | 7 +++----
 netax25/procutils.h | 9 ++++-----
 netax25/rsconfig.h  | 7 +++----
 netax25/ttyutils.h  | 7 +++----
 netrom/netrom.h     | 5 ++---
 netrose/rose.h      | 5 ++---
 12 files changed, 34 insertions(+), 46 deletions(-)

diff --git a/netax25/ax25.h b/netax25/ax25.h
index e1b6abb..ab579e7 100644
--- a/netax25/ax25.h
+++ b/netax25/ax25.h
@@ -12,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #ifndef _NETAX25_AX25_H
 #define _NETAX25_AX25_H	1
diff --git a/netax25/ax25io.h b/netax25/ax25io.h
index 48db214..80f6686 100644
--- a/netax25/ax25io.h
+++ b/netax25/ax25io.h
@@ -11,10 +11,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 #ifndef _AX25IO_H
 #define _AX25IO_H
diff --git a/netax25/axconfig.h b/netax25/axconfig.h
index 956de5e..ee02fa5 100644
--- a/netax25/axconfig.h
+++ b/netax25/axconfig.h
@@ -12,10 +12,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 /*
  * This file contains the definitions of the entry points into the AX.25
diff --git a/netax25/axlib.h b/netax25/axlib.h
index 61078d8..61673c5 100644
--- a/netax25/axlib.h
+++ b/netax25/axlib.h
@@ -12,10 +12,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 /*
  * Callsign conversion functions, converts callsigns into network bit
diff --git a/netax25/daemon.h b/netax25/daemon.h
index ff00886..421f684 100644
--- a/netax25/daemon.h
+++ b/netax25/daemon.h
@@ -12,10 +12,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 /*
  * Function to convert a running process into a "proper" daemon.
diff --git a/netax25/mheard.h b/netax25/mheard.h
index 0e979a8..721ca0b 100644
--- a/netax25/mheard.h
+++ b/netax25/mheard.h
@@ -12,10 +12,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 /*
  * This file documents the layout of the mheard file. Since this file is
diff --git a/netax25/nrconfig.h b/netax25/nrconfig.h
index 5b7953b..f184526 100644
--- a/netax25/nrconfig.h
+++ b/netax25/nrconfig.h
@@ -12,10 +12,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 /*
  * This file contains the definitions of the entry points into the NET/ROM
diff --git a/netax25/procutils.h b/netax25/procutils.h
index c3726ee..b8b1208 100644
--- a/netax25/procutils.h
+++ b/netax25/procutils.h
@@ -11,11 +11,10 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ :
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 /*
  * Support routines to simplify the reading of the /proc/net/ax25* and
diff --git a/netax25/rsconfig.h b/netax25/rsconfig.h
index f388bfd..ba10d2f 100644
--- a/netax25/rsconfig.h
+++ b/netax25/rsconfig.h
@@ -12,10 +12,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 /*
  * This file contains the definitions of the entry points into the Rose
diff --git a/netax25/ttyutils.h b/netax25/ttyutils.h
index 172de9a..c3cab84 100644
--- a/netax25/ttyutils.h
+++ b/netax25/ttyutils.h
@@ -12,10 +12,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/netrom/netrom.h b/netrom/netrom.h
index 4984772..ace3758 100644
--- a/netrom/netrom.h
+++ b/netrom/netrom.h
@@ -12,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #ifndef _NETROM_NETROM_H
 #define _NETROM_NETROM_H	1
diff --git a/netrose/rose.h b/netrose/rose.h
index e4ba7d7..b3cf686 100644
--- a/netrose/rose.h
+++ b/netrose/rose.h
@@ -13,9 +13,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 /* What follows is copied from the 2.1.93 <linux/rose.h>.  */
 
-- 
2.41.0


From c6970179b608be58c50587e32b5bcc994bebb643 Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 11 Apr 2019 02:03:29 +0200
Subject: [PATCH 03/14] configure: Remove AC_TYPE_SIGNAL.

AC_TYPE_SIGNAL only made sense for some SysV R3 crap which is only rotten
and (almost) forgotten.  We also don't support it.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 configure.ac | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 0056313..d122b02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,6 @@ AC_PROG_LIBTOOL
 
 dnl Checks for libraries.
 
-AC_TYPE_SIGNAL
 AC_CHECK_FUNC(setsid,, AC_MSG_ERROR([setsid not found]))
 AC_CHECK_FUNCS(socket strdup strerror strspn)
 
-- 
2.41.0


From 9ba554475beb3f441bc5a06f359e6563d9a2a135 Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 11 Apr 2019 02:06:39 +0200
Subject: [PATCH 04/14] configure: Replace AC_PROG_LIBTOOL with LT_INIT.

Recent autoconf versions have retired AC_PROG_LIBTOOL (and AM_PROG_LIBTOOL)
in favor of LT_INIT.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d122b02..d2db4ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ AC_CONFIG_HEADERS(config.h)
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_GCC_TRADITIONAL
-AC_PROG_LIBTOOL
+LT_INIT
 
 dnl Checks for libraries.
 
-- 
2.41.0


From b17ff362f5e006faa87174608e663153aa5fb007 Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 11 Apr 2019 13:12:02 +0200
Subject: [PATCH 05/14] configure: Paranoidly quote things for m4 macro
 expansion safety.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index d2db4ca..31eeaf8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
-AC_PREREQ(2.59)
-AC_INIT(libax25, 0.0.12-rc5, linux-hams@vger.kernel.org)
+AC_PREREQ([2.59])
+AC_INIT([libax25],[0.0.12-rc5],[linux-hams@vger.kernel.org])
 AC_CONFIG_MACRO_DIRS([m4])
 AC_CONFIG_SRCDIR(axconfig.c)
 AM_INIT_AUTOMAKE([foreign no-define 1.7])
-- 
2.41.0


From f7e4a620aaa061bca62c2cef7dd508157e482c68 Mon Sep 17 00:00:00 2001
From: Thomas Osterried <ax25@x-berg.in-berlin.de>
Date: Wed, 3 Feb 2021 15:27:28 +0100
Subject: [PATCH 06/14] This fixes a bug in ttyutils.c for tty_is_locked,
 tty_lock() and tty_unlock() for very long path names, i.e.    kissattach
 /dev/serial/by-id/usb-FTDI_usb_serial_converter_FTCAWZIA-if00-port 0 tnc   
 -> Segmentation fault because buffer[50] was not only too short; the length
 was also not checked.

Thanks to David KI6ZHD for reporting this bug.

Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
---
 ttyutils.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/ttyutils.c b/ttyutils.c
index 580e9a6..a374103 100644
--- a/ttyutils.c
+++ b/ttyutils.c
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <limits.h>
 
 #include <netax25/ttyutils.h>
 #include "pathnames.h"
@@ -100,7 +101,7 @@ int tty_speed(int fd, int speed)
 
 int tty_is_locked(char *tty)
 {
-	char buffer[50], *s;
+	char buffer[PATH_MAX], *s;
 	FILE *fp;
 	int pid = 0;
 
@@ -109,7 +110,9 @@ int tty_is_locked(char *tty)
 	else
 		s = tty;
 
-	sprintf(buffer, "%s/LCK..%s", LOCK_SERIAL_DIR, s);
+	memset(buffer, 0, sizeof(buffer));
+	sprintf(buffer, "%s/LCK..", LOCK_SERIAL_DIR);
+	strncat(buffer+strlen(buffer), s, sizeof(buffer)-strlen(buffer)-1);
 
 	if ((fp = fopen(buffer, "r")) == NULL)
 		return FALSE;
@@ -129,7 +132,7 @@ int tty_is_locked(char *tty)
 
 int tty_lock(char *tty)
 {
-	char buffer[50], *s;
+	char buffer[PATH_MAX], *s;
 	FILE *fp;
 
 	if ((s = strrchr(tty, '/')) != NULL)
@@ -137,7 +140,9 @@ int tty_lock(char *tty)
 	else
 		s = tty;
 
-	sprintf(buffer, "%s/LCK..%s", LOCK_SERIAL_DIR, s);
+	memset(buffer, 0, sizeof(buffer));
+	sprintf(buffer, "%s/LCK..", LOCK_SERIAL_DIR);
+	strncat(buffer+strlen(buffer), s, sizeof(buffer)-strlen(buffer)-1);
 
 	if ((fp = fopen(buffer, "w")) == NULL)
 		return FALSE;
@@ -151,14 +156,16 @@ int tty_lock(char *tty)
 
 int tty_unlock(char *tty)
 {
-	char buffer[50], *s;
+	char buffer[PATH_MAX], *s;
 
 	if ((s = strrchr(tty, '/')) != NULL)
 		s++;
 	else
 		s = tty;
 
-	sprintf(buffer, "%s/LCK..%s", LOCK_SERIAL_DIR, s);
+	memset(buffer, 0, sizeof(buffer));
+	sprintf(buffer, "%s/LCK..", LOCK_SERIAL_DIR);
+	strncat(buffer+strlen(buffer), s, sizeof(buffer)-strlen(buffer)-1);
 
 	return unlink(buffer) == 0;
 }
-- 
2.41.0


From f0b65a22153cd28a8c3f3ab44a049a6fe1cb8136 Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Sun, 25 Jul 2021 23:42:50 +0200
Subject: [PATCH 07/14] Rename COPYING.LIB to COPYING.

libax25 is under the terms of the GNU Lesser General Public License which
in most other packages is shipping in a file COPYING.LIB.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 COPYING => COPYING.LIB | 0
 libax25.spec.in        | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename COPYING => COPYING.LIB (100%)

diff --git a/COPYING b/COPYING.LIB
similarity index 100%
rename from COPYING
rename to COPYING.LIB
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
-- 
2.41.0


From d0881ea1c01e0e782a24a73e23762626c1baf2f7 Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Mon, 26 Jul 2021 21:59:59 +0200
Subject: [PATCH 08/14] axconfig.c: Fix devilishly suggestive false
 indentation.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 axconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/axconfig.c b/axconfig.c
index 84199c1..9486f5b 100644
--- a/axconfig.c
+++ b/axconfig.c
@@ -308,7 +308,7 @@ 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));
-- 
2.41.0


From 415b2d46a39302b21b51758e83f81e5439ab487c Mon Sep 17 00:00:00 2001
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 29 Jul 2021 09:13:19 +0200
Subject: [PATCH 09/14] axconfig.c, nrconfig.c, roseconfig.c: Fix GCC 11
 warnings.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

GCC 11's overyealously throws below warnings.  Fixed by giving GCC a hint
that the string actually is short enough to fit.

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -DAX25_SYSCONFDIR=\"/usr/local/etc/ax25/\" -DAX25_LOCALSTATEDIR=\"/usr/local/var/ax25/\" -g -O2 -Wall -MT axconfig.lo -MD -MP -MF .deps/axconfig.Tpo -c axconfig.c  -fPIC -DPIC -o .libs/axconfig.o
axconfig.c: In function ‘ax25_config_load_ports’:
axconfig.c:315:25: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Wstringop-truncation]
  315 |                         strncpy(ifr.ifr_name, s, IFNAMSIZ-1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -DAX25_SYSCONFDIR=\"/usr/local/etc/ax25/\" -DAX25_LOCALSTATEDIR=\"/usr/local/var/ax25/\" -g -O2 -Wall -MT nrconfig.lo -MD -MP -MF .deps/nrconfig.Tpo -c nrconfig.c  -fPIC -DPIC -o .libs/nrconfig.o
nrconfig.c: In function ‘nr_config_load_ports’:
nrconfig.c:294:25: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Wstringop-truncation]
  294 |                         strncpy(ifr.ifr_name, s, IFNAMSIZ-1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -DAX25_SYSCONFDIR=\"/usr/local/etc/ax25/\" -DAX25_LOCALSTATEDIR=\"/usr/local/var/ax25/\" -g -O2 -Wall -MT rsconfig.lo -MD -MP -MF .deps/rsconfig.Tpo -c rsconfig.c  -fPIC -DPIC -o .libs/rsconfig.o
rsconfig.c: In function ‘rs_config_load_ports’:
rsconfig.c:240:25: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Wstringop-truncation]
  240 |                         strncpy(ifr.ifr_name, s, IFNAMSIZ-1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 axconfig.c |  4 ++++
 nrconfig.c |  4 ++++
 rsconfig.c |  3 +++
 util.h     | 12 ++++++++++++
 4 files changed, 23 insertions(+)
 create mode 100644 util.h

diff --git a/axconfig.c b/axconfig.c
index 9486f5b..c6a2cb0 100644
--- a/axconfig.c
+++ b/axconfig.c
@@ -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;
 
diff --git a/nrconfig.c b/nrconfig.c
index 003dfb2..18fb6e1 100644
--- a/nrconfig.c
+++ b/nrconfig.c
@@ -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;
 
diff --git a/rsconfig.c b/rsconfig.c
index 21b91e0..8c7712b 100644
--- a/rsconfig.c
+++ b/rsconfig.c
@@ -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;
 
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..2d2c252
--- /dev/null
+++ b/util.h
@@ -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  */
-- 
2.41.0


From 25619cc79e58a68bf88381a75ecdf93a9b8f9c90 Mon Sep 17 00:00:00 2001
From: Thomas Osterried <ax25@x-berg.in-berlin.de>
Date: Mon, 2 May 2022 02:13:05 +0200
Subject: [PATCH 10/14] ttyutils.c: added support for higher baud rates.

Signed-off-by: John Paul Morrison<jmorrison@bogomips.com>
---
 ttyutils.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/ttyutils.c b/ttyutils.c
index a374103..6ffd2fb 100644
--- a/ttyutils.c
+++ b/ttyutils.c
@@ -32,6 +32,39 @@ static struct speed_struct {
 #endif
 #ifdef  B460800
 	{460800,	B460800},
+#endif
+#ifdef  B500000
+	{500000,	B500000},
+#endif
+#ifdef  B576000
+	{576000,	B576000},
+#endif
+#ifdef  B921600
+	{921600,	B921600},
+#endif
+#ifdef  B1000000
+	{1000000,	B1000000},
+#endif
+#ifdef  B1152000
+	{1152000,	B1152000},
+#endif
+#ifdef  B1500000
+	{1500000,	B1500000},
+#endif
+#ifdef  B2000000
+	{2000000,	B2000000},
+#endif
+#ifdef  B2500000
+	{2500000,	B2500000},
+#endif
+#ifdef  B3000000
+	{3000000,	B3000000},
+#endif
+#ifdef  B3500000
+	{1000000,	B3500000},
+#endif
+#ifdef  B4000000
+	{4000000,	B4000000},
 #endif
 	{-1,		B0}
 };
-- 
2.41.0


From 788ac03ebbf46f2a65a598ff8ea483ecb97de77d Mon Sep 17 00:00:00 2001
From: Thomas Osterried <ax25@x-berg.in-berlin.de>
Date: Fri, 16 Sep 2022 12:00:12 +0200
Subject: [PATCH 11/14] Hint for first time compilation

Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
---
 README.compile | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 README.compile

diff --git a/README.compile b/README.compile
new file mode 100644
index 0000000..debee8e
--- /dev/null
+++ b/README.compile
@@ -0,0 +1,12 @@
+After checkout:
+
+  autoreconf --install --force
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man 
+
+Compile:
+  make
+
+Onle once (if you did not have configuration files in /etc; if you have, they
+will be overwritten!):
+  make installconf
+
-- 
2.41.0


From 1ce8d1e7166c9e7fff65742bbaad8817f7f445f0 Mon Sep 17 00:00:00 2001
From: Thomas Osterried <dl9sau@www.linux-ax25.org>
Date: Wed, 4 Jan 2023 04:22:28 +0100
Subject: [PATCH 12/14] Fixed typo in B3500000 declaration, introduced by
 commit 25619cc79e58a68bf88381a75ecdf93a9b8f9c90

Impact: these new very high speed baudrate may not have been needed
in the past.

Signed-off-by: Nate Bargmann <n0nb@n0nb.us>
Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
---
 ttyutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ttyutils.c b/ttyutils.c
index 6ffd2fb..94e6c09 100644
--- a/ttyutils.c
+++ b/ttyutils.c
@@ -61,7 +61,7 @@ static struct speed_struct {
 	{3000000,	B3000000},
 #endif
 #ifdef  B3500000
-	{1000000,	B3500000},
+	{B3500000,	B3500000},
 #endif
 #ifdef  B4000000
 	{4000000,	B4000000},
-- 
2.41.0


From 5136001b377a302b96dac8d420853810c8f58c04 Mon Sep 17 00:00:00 2001
From: Thomas Osterried <dl9sau@www.linux-ax25.org>
Date: Wed, 4 Jan 2023 04:28:08 +0100
Subject: [PATCH 13/14] Fixed typo in B3500000 declaration, introduced by
 commit 25619cc79e58a68bf88381a75ecdf93a9b8f9c90

Impact: these new very high speed baudrate may not have been needed
in the past.

Signed-off-by: Nate Bargmann <n0nb@n0nb.us>
Signed-off-by: Thomas Osterried <ax25@x-berg.in-berlin.de>
---
 ttyutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ttyutils.c b/ttyutils.c
index 94e6c09..6bd6b56 100644
--- a/ttyutils.c
+++ b/ttyutils.c
@@ -61,7 +61,7 @@ static struct speed_struct {
 	{3000000,	B3000000},
 #endif
 #ifdef  B3500000
-	{B3500000,	B3500000},
+	{3500000,	B3500000},
 #endif
 #ifdef  B4000000
 	{4000000,	B4000000},
-- 
2.41.0


From 5581005c3f7b2b78ce38433aa0d1c64aba4167d0 Mon Sep 17 00:00:00 2001
From: Thomas Osterried <ax25@x-berg.in-berlin.de>
Date: Sat, 13 May 2023 21:14:13 +0200
Subject: [PATCH 14/14] Fixed spelling errors

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
---
 ChangeLog | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 11c5aa4..511e9f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,7 +16,7 @@ libax25 0.0.12
 	* Fix build issues with modern autoconf, automake and GCC.
 	* For the tarball release Regenerate generates files with most
 	  recent autoconf and automake.
-	* Improvments to git usage.
+	* Improvements to git usage.
 	* Update to work without warnings with latest autotools.
 	* Lots of stylistic cleanups to the code trying to follow the
 	  coding style of the kernel.
@@ -26,7 +26,7 @@ libax25 0.0.12
 
 libax25 0.0.11
 	* libax25io handles nonblocking io correctly. (PE1RXQ)
-	  THIS BREAKS PRACTICLY EVERY APP USING THIS LIBRARY, FIX THEM!!!
+	  THIS BREAKS PRACTICALLY EVERY APP USING THIS LIBRARY, FIX THEM!!!
 
  -- Craig Small <csmall@small.dropbear.id.au>  Fri, 21 Feb 2003 21:33:48 +1100
 
-- 
2.41.0

