From 637cca8797c8b59ce6f071ac4e86eb46da765b05 Mon Sep 17 00:00:00 2001 From: idealeer Date: Fri, 23 Sep 2022 15:32:08 +0800 Subject: [PATCH] 1.1.2 2022-09-23 # 1.1.2 2022-09-23 * XMap 1.1.2 Minor Release. * Fix Bugs: * Fix the print issue of DNS modules --- CHANGELOG.md | 5 +++++ src/probe_modules/module_dnsf.c | 6 ++++-- src/probe_modules/module_dnsr.c | 6 ++++-- src/probe_modules/module_dnss.c | 6 ++++-- src/probe_modules/module_dnsv.c | 6 ++++-- src/probe_modules/module_dnsx.c | 10 ++++++---- src/probe_modules/module_dnsz.c | 6 ++++-- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15c48e5..b5e3b41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,3 +27,8 @@ * XMap 1.1.1 Minor Release. * Fix Bugs: * Fix the memory leakage issue + +# 1.1.2 2022-09-23 +* XMap 1.1.2 Minor Release. +* Fix Bugs: + * Fix the print issue of DNS modules diff --git a/src/probe_modules/module_dnsf.c b/src/probe_modules/module_dnsf.c index 40d29ef..a25f074 100644 --- a/src/probe_modules/module_dnsf.c +++ b/src/probe_modules/module_dnsf.c @@ -123,7 +123,7 @@ static int index_questions_f = 0; * (below, and setup_qtype_str_map_f()) */ const char *qtype_strs_f[] = {"A", "NS", "CNAME", "SOA", "PTR", - "MX", "TXT", "AAAA", "RRSIG", "ANY"}; + "MX", "TXT", "AAAA", "RRSIG", "ANY"}; const int qtype_strs_len_f = 10; const dns_qtype qtype_strid_to_qtype_f[] = { @@ -1049,9 +1049,11 @@ void dnsf_print_packet(FILE *fp, void *packet) { uint16_t bytes_consumed = 0; char *question_name = get_name_f(data, data_len, (char *) dns_header_p, udp_len, &bytes_consumed); + char *qname = ((char *) dns_header_p) + sizeof(dns_header); + int qname_len = strlen(qname) + 1; dns_question_tail *tail_p = (dns_question_tail *) ((char *) dns_header_p + sizeof(dns_header) + - strlen(question_name)); + qname_len); fprintf_eth_header(fp, eth_header); fprintf_ip_header(fp, ip_header); diff --git a/src/probe_modules/module_dnsr.c b/src/probe_modules/module_dnsr.c index 2d4b475..05156fe 100644 --- a/src/probe_modules/module_dnsr.c +++ b/src/probe_modules/module_dnsr.c @@ -118,7 +118,7 @@ static int index_questions_r = 0; * (below, and setup_qtype_str_map_r()) */ const char *qtype_strs_r[] = {"A", "NS", "CNAME", "SOA", "PTR", - "MX", "TXT", "AAAA", "RRSIG", "ANY"}; + "MX", "TXT", "AAAA", "RRSIG", "ANY"}; const int qtype_strs_len_r = 10; const dns_qtype qtype_strid_to_qtype_r[] = { @@ -1038,9 +1038,11 @@ void dnsr_print_packet(FILE *fp, void *packet) { uint16_t bytes_consumed = 0; char *question_name = get_name_r(data, data_len, (char *) dns_header_p, udp_len, &bytes_consumed); + char *qname = ((char *) dns_header_p) + sizeof(dns_header); + int qname_len = strlen(qname) + 1; dns_question_tail *tail_p = (dns_question_tail *) ((char *) dns_header_p + sizeof(dns_header) + - strlen(question_name)); + qname_len); fprintf_eth_header(fp, eth_header); fprintf_ip_header(fp, ip_header); diff --git a/src/probe_modules/module_dnss.c b/src/probe_modules/module_dnss.c index e1b732c..3c0aa13 100644 --- a/src/probe_modules/module_dnss.c +++ b/src/probe_modules/module_dnss.c @@ -118,7 +118,7 @@ static int index_questions_s = 0; * (below, and setup_qtype_str_map_s()) */ const char *qtype_strs_s[] = {"A", "NS", "CNAME", "SOA", "PTR", - "MX", "TXT", "AAAA", "RRSIG", "ANY"}; + "MX", "TXT", "AAAA", "RRSIG", "ANY"}; const int qtype_strs_len_s = 10; const dns_qtype qtype_strid_to_qtype_s[] = { @@ -1055,9 +1055,11 @@ void dnss_print_packet(FILE *fp, void *packet) { uint16_t bytes_consumed = 0; char *question_name = get_name_s(data, data_len, (char *) dns_header_p, udp_len, &bytes_consumed); + char *qname = ((char *) dns_header_p) + sizeof(dns_header); + int qname_len = strlen(qname) + 1; dns_question_tail *tail_p = (dns_question_tail *) ((char *) dns_header_p + sizeof(dns_header) + - strlen(question_name)); + qname_len); fprintf_eth_header(fp, eth_header); fprintf_ip_header(fp, ip_header); diff --git a/src/probe_modules/module_dnsv.c b/src/probe_modules/module_dnsv.c index ecade38..423f7cf 100644 --- a/src/probe_modules/module_dnsv.c +++ b/src/probe_modules/module_dnsv.c @@ -119,7 +119,7 @@ static int index_questions_v = 0; * (below, and setup_qtype_str_map_v()) */ const char *qtype_strs_v[] = {"A", "NS", "CNAME", "SOA", "PTR", - "MX", "TXT", "AAAA", "RRSIG", "ANY"}; + "MX", "TXT", "AAAA", "RRSIG", "ANY"}; const int qtype_strs_len_v = 10; const dns_qtype qtype_strid_to_qtype_v[] = { @@ -1048,9 +1048,11 @@ void dnsv_print_packet(FILE *fp, void *packet) { uint16_t bytes_consumed = 0; char *question_name = get_name_v(data, data_len, (char *) dns_header_p, udp_len, &bytes_consumed); + char *qname = ((char *) dns_header_p) + sizeof(dns_header); + int qname_len = strlen(qname) + 1; dns_question_tail *tail_p = (dns_question_tail *) ((char *) dns_header_p + sizeof(dns_header) + - strlen(question_name)); + qname_len); fprintf_eth_header(fp, eth_header); fprintf_ip_header(fp, ip_header); diff --git a/src/probe_modules/module_dnsx.c b/src/probe_modules/module_dnsx.c index d6475a1..eeb22a7 100644 --- a/src/probe_modules/module_dnsx.c +++ b/src/probe_modules/module_dnsx.c @@ -119,9 +119,9 @@ static int index_questions_x = 0; * (below, and setup_qtype_str_map_x()) */ const char *qtype_strs_x[] = {"A", "NS", "CNAME", "SOA", "PTR", - "MX", "TXT", "AAAA", "RRSIG", "ANY", - "SIG", "SRV", "DS", "DNSKEY", "TLSA", - "SVCB", "HTTPS", "CAA", "HTTPSSVC"}; + "MX", "TXT", "AAAA", "RRSIG", "ANY", + "SIG", "SRV", "DS", "DNSKEY", "TLSA", + "SVCB", "HTTPS", "CAA", "HTTPSSVC"}; const int qtype_strs_len_x = 19; const dns_qtype qtype_strid_to_qtype_x[] = { @@ -1081,9 +1081,11 @@ void dnsx_print_packet(FILE *fp, void *packet) { uint16_t bytes_consumed = 0; char *question_name = get_name_x(data, data_len, (char *) dns_header_p, udp_len, &bytes_consumed); + char *qname = ((char *) dns_header_p) + sizeof(dns_header); + int qname_len = strlen(qname) + 1; dns_question_tail *tail_p = (dns_question_tail *) ((char *) dns_header_p + sizeof(dns_header) + - strlen(question_name)); + qname_len); fprintf_eth_header(fp, eth_header); fprintf_ip_header(fp, ip_header); diff --git a/src/probe_modules/module_dnsz.c b/src/probe_modules/module_dnsz.c index 815a0e7..0251894 100644 --- a/src/probe_modules/module_dnsz.c +++ b/src/probe_modules/module_dnsz.c @@ -118,7 +118,7 @@ static int index_questions_z = 0; * (below, and setup_qtype_str_map_z()) */ const char *qtype_strs_z[] = {"A", "NS", "CNAME", "SOA", "PTR", - "MX", "TXT", "AAAA", "RRSIG", "ANY"}; + "MX", "TXT", "AAAA", "RRSIG", "ANY"}; const int qtype_strs_len_z = 10; const dns_qtype qtype_strid_to_qtype_z[] = { @@ -1038,9 +1038,11 @@ void dnsz_print_packet(FILE *fp, void *packet) { uint16_t bytes_consumed = 0; char *question_name = get_name_z(data, data_len, (char *) dns_header_p, udp_len, &bytes_consumed); + char *qname = ((char *) dns_header_p) + sizeof(dns_header); + int qname_len = strlen(qname) + 1; dns_question_tail *tail_p = (dns_question_tail *) ((char *) dns_header_p + sizeof(dns_header) + - strlen(question_name)); + qname_len); fprintf_eth_header(fp, eth_header); fprintf_ip_header(fp, ip_header);