Explorar el Código

check_dns: buffer overflow fix

~/nagios-plugins-2.4.4/plugins# ./check_dns -H google.com -n -q CNAME
*** buffer overflow detected ***: terminated
Aborted (core dumped)

check_dns CNAME query type is currently hitting a buffer overflow on Ubuntu 22.04. 

char query_type[16] = "";

This commit increases the size of the query_type array to 17 bytes which allows enough space to hold the entire string "CNAME" plus the "-querytype=" prefix and the null terminator, so there is no buffer overflow and the program runs without crashing.
benbyr hace 2 años
padre
commit
1cd36cf77c
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      plugins/check_dns.c

+ 1 - 1
plugins/check_dns.c

@@ -60,7 +60,7 @@ char query_address[ADDRESS_LENGTH] = "";
 char dns_server[ADDRESS_LENGTH] = "";
 char tmp_dns_server[ADDRESS_LENGTH] = "";
 char ptr_server[ADDRESS_LENGTH] = "";
-char query_type[16] = "";
+char query_type[17] = "";
 int query_set = FALSE;
 int verbose = FALSE;
 char **expected_address = NULL;