Package: pnscan
Version: 1.11-3
Severity: normal
Tags: upstream patch

pnscan segfaults when running without parameters and an empty line
as input:

$ echo | pnscan
Segmentation fault (core dumped)

$ gdb /usr/bin/pnscan core
[...]
Program terminated with signal 11, Segmentation fault.
#0  0xb7e17b26 in strtok_r () from /lib/tls/libc.so.6

This is a bug in the original program:

====================================================================

--- pnscan-wrong.c	2007-10-20 23:08:00.000000000 +0200
+++ pnscan.c	2007-10-20 23:08:06.000000000 +0200
@@ -816,7 +816,6 @@
 	}
 
 	host = strtok_r(buf, " \t\n\r", &tokp);
-	serv = strtok_r(NULL, " \t\n\r", &tokp);
 	
 	if (host == NULL || host[0] == '#')
 	    continue;
@@ -828,6 +827,8 @@
 	    continue;
 	}
 	
+	serv = strtok_r(NULL, " \t\n\r", &tokp);
+
 	if (serv == NULL)
 	{
 	    if (first_port == 0)

=======================================================================

Please forward to upstream.



