X-Git-Url: https://git.saurik.com/apple/network_cmds.git/blobdiff_plain/b7080c8e96625177072137d504eb8e9c9d748e49..2b484d24084b903459c5b416c06cd77b48c748b9:/rwhod.tproj/rwhod.c diff --git a/rwhod.tproj/rwhod.c b/rwhod.tproj/rwhod.c index 6094340..cbff644 100644 --- a/rwhod.tproj/rwhod.c +++ b/rwhod.tproj/rwhod.c @@ -75,6 +75,7 @@ static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93"; #include #include #include +#include #include #include @@ -207,17 +208,23 @@ main(argc, argv) continue; } if (from.sin_port != sp->s_port) { - syslog(LOG_WARNING, "%d: bad from port", - ntohs(from.sin_port)); + syslog(LOG_WARNING, "%d: bad source port from %s", + ntohs(from.sin_port), inet_ntoa(from.sin_addr)); continue; } + if (cc < WHDRSIZE) { + syslog(LOG_WARNING, "short packet from %s", + inet_ntoa(from.sin_addr)); + continue; + } + if (wd.wd_vers != WHODVERSION) continue; if (wd.wd_type != WHODTYPE_STATUS) continue; if (!verify(wd.wd_hostname)) { - syslog(LOG_WARNING, "malformed host name from %x", - from.sin_addr); + syslog(LOG_WARNING, "malformed host name from %s", + inet_ntoa(from.sin_addr)); continue; } (void) sprintf(path, "whod.%s", wd.wd_hostname);