Просмотр исходного кода

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 2 лет назад
Родитель
Сommit
1cd36cf77c
1 измененных файлов с 1 добавлено и 1 удалено
  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;