whois: limit total length of response to 32+2 kb

function                                             old     new   delta
query                                                517     554     +37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2019-12-03 14:52:17 +01:00
parent 356f23de20
commit 9ec836c033

View File

@ -53,7 +53,9 @@ static char *query(const char *host, int port, const char *domain)
fp = xfdopen_for_read(fd);
success = 0;
while (fgets(linebuf, sizeof(linebuf)-1, fp)) {
while (bufpos < 32*1024 /* paranoia */
&& fgets(linebuf, sizeof(linebuf)-1, fp)
) {
unsigned len;
len = strcspn(linebuf, "\r\n");