Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/lpr/lpd die if fd_set overruns
details: https://anonhg.NetBSD.org/src/rev/756b24f5edee
branches: trunk
changeset: 535045:756b24f5edee
user: itojun <itojun%NetBSD.org@localhost>
date: Fri Aug 09 02:40:57 2002 +0000
description:
die if fd_set overruns
diffstat:
usr.sbin/lpr/lpd/lpd.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (40 lines):
diff -r 1e104d640a74 -r 756b24f5edee usr.sbin/lpr/lpd/lpd.c
--- a/usr.sbin/lpr/lpd/lpd.c Fri Aug 09 02:39:15 2002 +0000
+++ b/usr.sbin/lpr/lpd/lpd.c Fri Aug 09 02:40:57 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lpd.c,v 1.35 2002/07/14 15:28:00 wiz Exp $ */
+/* $NetBSD: lpd.c,v 1.36 2002/08/09 02:40:57 itojun Exp $ */
/*
* Copyright (c) 1983, 1993, 1994
@@ -45,7 +45,7 @@
#if 0
static char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) 5/10/95";
#else
-__RCSID("$NetBSD: lpd.c,v 1.35 2002/07/14 15:28:00 wiz Exp $");
+__RCSID("$NetBSD: lpd.c,v 1.36 2002/08/09 02:40:57 itojun Exp $");
#endif
#endif /* not lint */
@@ -292,6 +292,10 @@
(void) umask(0);
sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
FD_ZERO(&defreadfds);
+ if (funix >= FD_SETSIZE) {
+ syslog(LOG_ERR, "descriptor too big");
+ exit(1);
+ }
FD_SET(funix, &defreadfds);
listen(funix, 5);
if (!sflag || blist_addrs)
@@ -307,6 +311,10 @@
if (finet) {
for (i = 1; i <= *finet; i++) {
+ if (finet[i] >= FD_SETSIZE) {
+ syslog(LOG_ERR, "descriptor too big");
+ exit(1);
+ }
FD_SET(finet[i], &defreadfds);
listen(finet[i], 5);
}
Home |
Main Index |
Thread Index |
Old Index