Module Name:    src
Committed By:   dholland
Date:           Thu Mar 25 16:36:00 UTC 2010

Modified Files:
        src/usr.sbin/inetd: inetd.c

Log Message:
Avoid SIGSEGV in forked child process for (some?) instant-disconnect clients.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.115 src/usr.sbin/inetd/inetd.c:1.116
--- src/usr.sbin/inetd/inetd.c:1.115	Thu Oct 22 22:50:35 2009
+++ src/usr.sbin/inetd/inetd.c	Thu Mar 25 16:36:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.115 2009/10/22 22:50:35 tsarna Exp $	*/
+/*	$NetBSD: inetd.c,v 1.116 2010/03/25 16:36:00 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.115 2009/10/22 22:50:35 tsarna Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.116 2010/03/25 16:36:00 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -671,8 +671,12 @@
 				    ntohs(sep->se_ctrladdr_in.sin_port));
 			}
 			service = buf;
-			sockaddr_snprintf(abuf, sizeof(abuf), "%a",
-			    req.client->sin);
+			if (req.client->sin) {
+				sockaddr_snprintf(abuf, sizeof(abuf), "%a",
+				    req.client->sin);
+			} else {
+				strcpy(abuf, "(null)");
+			}
 		}
 		if (denied) {
 			syslog(deny_severity,

Reply via email to