diff options
-rw-r--r-- | networking/nslookup.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c index 24eae4010..249083e24 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c | |||
@@ -589,6 +589,7 @@ static int RESOLVFUNC res_mkquery(int op, const char *dname, int class, int type | |||
589 | if (l>253 || buflen<n || op>15u || class>255u || type>255u) | 589 | if (l>253 || buflen<n || op>15u || class>255u || type>255u) |
590 | return -1; | 590 | return -1; |
591 | 591 | ||
592 | //TODO: why do we even have the q[] array? Use buf[] directly! | ||
592 | /* Construct query template - ID will be filled later */ | 593 | /* Construct query template - ID will be filled later */ |
593 | memset(q, 0, n); | 594 | memset(q, 0, n); |
594 | q[2] = op*8 + 1; | 595 | q[2] = op*8 + 1; |
@@ -637,7 +638,12 @@ struct query { | |||
637 | unsigned qlen; | 638 | unsigned qlen; |
638 | // unsigned latency; | 639 | // unsigned latency; |
639 | // uint8_t rcode; | 640 | // uint8_t rcode; |
640 | unsigned char query[512]; | 641 | /* res_mkquery() balks on names > 253 chars. |
642 | * The formed query is 253+18 chars at max. | ||
643 | * Real hostnames are nowhere near that long anyway. | ||
644 | * Use of power-of-2 size means smaller code. | ||
645 | */ | ||
646 | unsigned char query[512 - sizeof(int) - sizeof(char*)]; | ||
641 | // unsigned char reply[512]; | 647 | // unsigned char reply[512]; |
642 | }; | 648 | }; |
643 | 649 | ||