[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#878322: ax25-tools: Various tools segfault when run



Package: ax25-tools
Version: 0.0.10-rc4-1
Severity: serious
Tags: upstream patch

Hi,
As discussed on IRC, various tools in ax25-tools segfault when run. For
example:

> $ /usr/sbin/kissnetd -p 5
> kissnetd V 1.5 by Frederic RIBLE F1OAT - ATEPRA FPAC/Linux Project
> [1]    22672 segmentation fault  /usr/sbin/kissnetd -p 5

This because the prototype for ptsname is not available, so it
implicitly returns an int, which gets cast back to a pointer, truncating
the return value. The attached patch fixes this by defining the relevant
feature macros to their required values so ptsname's prototype is
declared.

Regards,
James
--- a/kiss/kissattach.c
+++ b/kiss/kissattach.c
@@ -1,5 +1,6 @@
+#define _DEFAULT_SOURCE
+#define _XOPEN_SOURCE 500
 #include <stdio.h>
-#define __USE_XOPEN
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
--- a/kiss/kissnetd.c
+++ b/kiss/kissnetd.c
@@ -9,8 +9,9 @@
  * F1OAT 960804 - Frederic RIBLE
  */
  
+#define _DEFAULT_SOURCE
+#define _XOPEN_SOURCE 500
 #include <stdio.h>
-#define __USE_XOPEN
 #include <stdlib.h>
 #include <sys/time.h>
 #include <sys/types.h>
--- a/kiss/mkiss.c
+++ b/kiss/mkiss.c
@@ -37,8 +37,9 @@
  * 1.08 xx/xx/99 Tom Mazouch - Adjustable poll interval
  */
 
+#define _DEFAULT_SOURCE
+#define _XOPEN_SOURCE 500
 #include <stdio.h>
-#define __USE_XOPEN
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
--- a/kiss/net2kiss.c
+++ b/kiss/net2kiss.c
@@ -30,8 +30,9 @@
 
 /*****************************************************************************/
 
+#define _DEFAULT_SOURCE
+#define _XOPEN_SOURCE 500
 #include <stdio.h>
-#define __USE_XOPEN
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/time.h>
--- a/6pack/m6pack.c
+++ b/6pack/m6pack.c
@@ -33,8 +33,9 @@
  *********************************************************************
  */
 
+#define _DEFAULT_SOURCE
+#define _XOPEN_SOURCE 500
 #include <stdio.h>
-#define __USE_XOPEN
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>

Reply to: