summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-24 20:21:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-24 20:21:33 +0000
commitf9810176bc800a60b3771e7392d938c83db26178 (patch)
treecadff64cb101bd61eacb25efa5db514888a7737c /usr.sbin
parenta7d581324ae3e83118321b830dc7b13a7055765c (diff)
udp time may be contacted at dynamic reserved
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/inetd/inetd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index cc90b1a9188..c54241c5606 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.44 1997/12/23 23:46:16 deraadt Exp $ */
+/* $OpenBSD: inetd.c,v 1.45 1998/02/24 20:21:32 deraadt Exp $ */
/* $NetBSD: inetd.c,v 1.11 1996/02/22 11:14:41 mycroft Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/
-static char rcsid[] = "$OpenBSD: inetd.c,v 1.44 1997/12/23 23:46:16 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: inetd.c,v 1.45 1998/02/24 20:21:32 deraadt Exp $";
#endif /* not lint */
/*
@@ -1768,12 +1768,15 @@ machtime_dg(s, sep)
{
u_int result;
struct sockaddr sa;
+ struct sockaddr_in *sin;
int size;
size = sizeof(sa);
if (recvfrom(s, (char *)&result, sizeof(result), 0, &sa, &size) < 0)
return;
- if (dg_badinput((struct sockaddr_in *)&sa))
+ sin = (struct sockaddr_in *)&sa;
+ if (sin->sin_addr.s_addr == htonl(INADDR_BROADCAST) ||
+ ntohs(sin->sin_port) < IPPORT_RESERVED/2)
return;
result = machtime();
(void) sendto(s, (char *) &result, sizeof(result), 0, &sa, sizeof(sa));