aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/nslookup.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c
index d31801e96..c6f431347 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -271,8 +271,8 @@ struct query {
271}; 271};
272 272
273static const struct { 273static const struct {
274 int type; 274 unsigned char type;
275 const char *name; 275 char name[7];
276} qtypes[] = { 276} qtypes[] = {
277 { ns_t_soa, "SOA" }, 277 { ns_t_soa, "SOA" },
278 { ns_t_ns, "NS" }, 278 { ns_t_ns, "NS" },
@@ -285,7 +285,6 @@ static const struct {
285 { ns_t_txt, "TXT" }, 285 { ns_t_txt, "TXT" },
286 { ns_t_ptr, "PTR" }, 286 { ns_t_ptr, "PTR" },
287 { ns_t_any, "ANY" }, 287 { ns_t_any, "ANY" },
288 { }
289}; 288};
290 289
291static const char *const rcodes[] = { 290static const char *const rcodes[] = {
@@ -803,7 +802,7 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv)
803 ptr = chr + 1; 802 ptr = chr + 1;
804 803
805 for (c = 0;; c++) { 804 for (c = 0;; c++) {
806 if (!qtypes[c].name) 805 if (c == ARRAY_SIZE(qtypes))
807 bb_error_msg_and_die("invalid query type \"%s\"", ptr); 806 bb_error_msg_and_die("invalid query type \"%s\"", ptr);
808 if (strcmp(qtypes[c].name, ptr) == 0) 807 if (strcmp(qtypes[c].name, ptr) == 0)
809 break; 808 break;
@@ -836,13 +835,11 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv)
836 add_query(&queries, &n_queries, T_AAAA, *argv); 835 add_query(&queries, &n_queries, T_AAAA, *argv);
837#endif 836#endif
838 } 837 }
839 } 838 } else {
840 else {
841 int c; 839 int c;
842 for (c = 0; qtypes[c].name; c++) { 840 for (c = 0; c < ARRAY_SIZE(qtypes); c++) {
843 if (types & (1 << c)) 841 if (types & (1 << c))
844 add_query(&queries, &n_queries, qtypes[c].type, 842 add_query(&queries, &n_queries, qtypes[c].type, *argv);
845 *argv);
846 } 843 }
847 } 844 }
848 argv++; 845 argv++;