This patch is part of the Hardened Linux project (hardenedlinux.sf.net)
Author: Steffen Wendzel (WWW: http://www.wendzel.de)
Date:   Sun, 19. Aug. 2007

--- ../icmpinfo-1.11/defs.h	1994-05-26 15:36:40.000000000 +0200
+++ defs.h	2007-08-18 12:06:26.000000000 +0200
@@ -1,7 +1,6 @@
 /*
  * Includes, defines and global variables used between functions.
  */
-
 #include <stdio.h>
 #include <errno.h>
 extern int	errno;
@@ -24,9 +23,9 @@ extern int	errno;
 #endif
 #include <netinet/tcp.h>
 #include <netdb.h>
-
 #include <syslog.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 /*
  * Beware that the outgoing packet starts with the ICMP header and
@@ -53,6 +52,14 @@ DCLARE int     showsrcip;    /*  flag fo
 DCLARE int     syslogdoutput; /* flag for stdoutput / syslogd output */
 DCLARE int     noportquery;   /* flag for query/noquery of port -> serv name */
 
+int err_ret(char *);
+int pr_pack(char *, int, struct sockaddr_in *);
+void pid_file(void);
+void pid_kill(void);
+int err_quit(char *);
+int err_sys(char *);
+void recv_ping(void);
+
 /* on some hosts (linux) netinet/ip_icmp.h is missing/empty : */
 #ifndef ICMP_MINLEN
 int bug=You_need_an_non_empty_netinet_ip_icmp_h;
--- ../icmpinfo-1.11/err.c	1994-04-22 19:44:48.000000000 +0200
+++ err.c	2007-08-18 12:06:02.000000000 +0200
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <stdlib.h>
 
 extern char *pname;
 
--- ../icmpinfo-1.11/icmpinfo.c	2007-08-19 15:29:38.000000000 +0200
+++ icmpinfo.c	2007-08-18 12:03:05.000000000 +0200
@@ -102,6 +102,7 @@ char	**argv;
 			case 'k':
 				pid_kill();
 				exit(0);
+				/*NOTREACHED*/
 				break;
 			case 'h':
 		        default :
--- ../icmpinfo-1.11/pid.c	2007-08-19 15:29:38.000000000 +0200
+++ pid.c	2007-08-18 12:06:13.000000000 +0200
@@ -1,13 +1,13 @@
 #include <stdio.h>
 #include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 #define PIDFILE                 "/var/run/icmpinfo.pid"
 
 extern char *pname;
 
 void sig_handler(int);
-void pid_file(void);
-void pid_kill(void);
 
 void pid_file(void)
 {
--- ../icmpinfo-1.11/print.c	2007-08-19 15:29:38.000000000 +0200
+++ print.c	2007-08-19 15:26:27.000000000 +0200
@@ -15,8 +15,10 @@
  */
 
 #include <string.h>
+#include <time.h>
 #include	"defs.h"
 
+
 #ifndef ANSI_OFFSETOF
 #ifndef offsetof
 #        define offsetof(t,m)  (int)((&((t *)0L)->m))
@@ -42,7 +44,7 @@ struct sockaddr_in	*from;	/* address of 
   char			*pr_type(),*pr_subtype(),*strtime;
   struct hostent	*hostent=NULL;
   struct servent	*servent=NULL;
-  static char prbuf[1024];	/* provide enough room for even the longest hosts*/
+  static char prbuf[1024]={'\0'};	/* provide enough room for even the longest hosts*/
 	
   /*
    * We have to look at the IP header, to get its length.
@@ -51,15 +53,15 @@ struct sockaddr_in	*from;	/* address of 
    */
   ip = (struct ip *) buf;
   iphdrlen = ip->ip_hl << 2;	/* convert # 16-bit words to #bytes */
-  if (cc < iphdrlen + ICMP_MINLEN) {
+  if (cc < (iphdrlen + ICMP_MINLEN)) {
     sprintf(prbuf,"packet too short (%d bytes) from %s", cc,
 	    inet_ntoa(from->sin_addr));
     if (syslogdoutput) {
       syslog(LOG_WARNING,"%s",prbuf);
-      } else {
-	puts(prbuf);
-	fflush(stdout);
-      }
+    } else {
+      puts(prbuf);
+      fflush(stdout);
+    }
     return -1;
   }
   cc -= iphdrlen;
@@ -224,7 +226,7 @@ register int t;
 		"Dest_Unreachable",
 		"Source_Quench",
 		"Redirect",
-		"6",
+		"Alternate Host Address",
 		"7",
 		"Echo",
 		"RouterAdvert",
@@ -236,7 +238,22 @@ register int t;
 		"Info_Request",
 		"Info_Reply",
 		"Mask_Request",
-		"Mask_Reply"
+		"Mask_Reply",
+		"19 (Reserved for Security)",
+		/* 20-29: reserved for robustness experiment */
+		"20","21","22","23","24","25","26","27","28","29",
+		"Traceroute",
+		"Datagram Convers. Err.",
+		"Mobile Host Redir",
+		"IPv6 Where-Are-You",
+		"IPv6 I-Am-Here",
+		"Mobile Registration Request",
+		"Mobile Registration Reply",
+		"Domain Name Req",
+		"Domain Name Reply",
+		"SKIP",
+		"Photuris",
+		"41 (ICMP messages utilized by experimental mobility protocols such as Seamoby)"
 	};
 
 	if (t < 0 || t > 18) {
--- ../icmpinfo-1.11/recvping.c	2007-08-19 15:29:38.000000000 +0200
+++ recvping.c	2007-08-18 12:36:02.000000000 +0200
@@ -6,13 +6,13 @@
 
 #include	"defs.h"
 
-int recv_ping()
+void recv_ping()
 {
 	register int		n;
 #if !defined(__GLIBC__)
 	int			fromlen;
 #else /* __GLIBC__ */
-	socklen_t			fromlen;
+	socklen_t		fromlen;
 #endif /* __GLIBC__ */
 	struct sockaddr_in	from;
 

