mirror of
https://github.com/rfc1036/whois.git
synced 2026-08-31 07:30:22 +00:00
Merge d849a6ee42dabfa84704ef74d2da70c9013803c7 into 5a3a0594df61c0f488a5931e74be81e12e88b553
This commit is contained in:
commit
69b16ac714
9
whois.c
9
whois.c
@ -1005,10 +1005,17 @@ char *query_server(const char *server, const char *port, const char *query)
|
||||
err_sys("write");
|
||||
free(temp);
|
||||
|
||||
while (fgets(buf, sizeof(buf), fi)) {
|
||||
while (fgets(buf, sizeof(buf), fi)) {
|
||||
if ((p = strpbrk(buf, "\r\n"))) /* remove the trailing CR/LF */
|
||||
*p = '\0';
|
||||
|
||||
/* strip terminal control characters to prevent escape sequence injection */
|
||||
for (p = buf; *p; p++)
|
||||
if ((unsigned char)*p < 0x20 && *p != '\t')
|
||||
*p = '?';
|
||||
if ((p = strchr(buf, '\x7f')))
|
||||
*p = '\0';
|
||||
|
||||
if (referral_handler)
|
||||
referral_handler(&referral_server, buf);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user