Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/inetd Avoid SIGSEGV in forked child process for (so...



details:   https://anonhg.NetBSD.org/src/rev/9e14169ba3d3
branches:  trunk
changeset: 753388:9e14169ba3d3
user:      dholland <dholland%NetBSD.org@localhost>
date:      Thu Mar 25 16:36:00 2010 +0000

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

diffstat:

 usr.sbin/inetd/inetd.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 98a6c6e89e46 -r 9e14169ba3d3 usr.sbin/inetd/inetd.c
--- a/usr.sbin/inetd/inetd.c    Thu Mar 25 15:34:30 2010 +0000
+++ b/usr.sbin/inetd/inetd.c    Thu Mar 25 16:36:00 2010 +0000
@@ -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,



Home | Main Index | Thread Index | Old Index