aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/whois.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/networking/whois.c b/networking/whois.c
index f0ec86301..f3da32b4e 100644
--- a/networking/whois.c
+++ b/networking/whois.c
@@ -39,20 +39,26 @@ static char *query(const char *host, int port, const char *domain)
39 bool success; 39 bool success;
40 char *redir = NULL; 40 char *redir = NULL;
41 const char *pfx = ""; 41 const char *pfx = "";
42 char linebuf[1024]; 42 /* some .io domains reported to have very long strings in whois
43 * responses, 1k was not enough:
44 */
45 char linebuf[2 * 1024];
43 char *buf = NULL; 46 char *buf = NULL;
44 unsigned bufpos = 0; 47 unsigned bufpos = 0;
45 48
46 again: 49 again:
47 printf("[Querying %s:%d '%s%s']\n", host, port, pfx, domain); 50 printf("[Querying %s:%d '%s%s']\n", host, port, pfx, domain);
48 fd = create_and_connect_stream_or_die(host, port); 51 fd = create_and_connect_stream_or_die(host, port);
49 success = 0;
50 fdprintf(fd, "%s%s\r\n", pfx, domain); 52 fdprintf(fd, "%s%s\r\n", pfx, domain);
51 fp = xfdopen_for_read(fd); 53 fp = xfdopen_for_read(fd);
52 54
53 while (fgets(linebuf, sizeof(linebuf), fp)) { 55 success = 0;
54 unsigned len = strcspn(linebuf, "\r\n"); 56 while (fgets(linebuf, sizeof(linebuf)-1, fp)) {
57 unsigned len;
58
59 len = strcspn(linebuf, "\r\n");
55 linebuf[len++] = '\n'; 60 linebuf[len++] = '\n';
61 linebuf[len] = '\0';
56 62
57 buf = xrealloc(buf, bufpos + len + 1); 63 buf = xrealloc(buf, bufpos + len + 1);
58 memcpy(buf + bufpos, linebuf, len); 64 memcpy(buf + bufpos, linebuf, len);