From eee651a650e987c5a3e656f914acee58ea353256 Mon Sep 17 00:00:00 2001 From: dwmalone Date: Wed, 28 Mar 2001 13:41:19 +0000 Subject: Allow ident requests with trailing junk following the terminating "\n". Reviewed by: ben Approved by: green --- usr.sbin/inetd/builtins.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/inetd/builtins.c b/usr.sbin/inetd/builtins.c index 0083932..ad0160b 100644 --- a/usr.sbin/inetd/builtins.c +++ b/usr.sbin/inetd/builtins.c @@ -464,7 +464,7 @@ ident_stream(s, sep) /* Ident service (AKA "auth") */ size = 0; bufsiz = sizeof(buf) - 1; FD_ZERO(&fdset); - while (bufsiz > 0 && (size == 0 || buf[size - 1] != '\n')) { + while (bufsiz > 0) { gettimeofday(&tv, NULL); tv.tv_sec = to.tv_sec - tv.tv_sec; tv.tv_usec = to.tv_usec - tv.tv_usec; @@ -488,6 +488,8 @@ ident_stream(s, sep) /* Ident service (AKA "auth") */ break; bufsiz -= ssize; size += ssize; + if (memchr(&buf[size - ssize], '\n', ssize) != NULL) + break; } buf[size] = '\0'; /* Read two characters, and check for a delimiting character */ -- cgit v1.1