Sfoglia il codice sorgente

[check_dns] Rework previous patch to be more secure.

Bill Blough 10 anni fa
parent
commit
7c344a1f05
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      plugins/check_dns.c

+ 2 - 2
plugins/check_dns.c

@@ -32,8 +32,8 @@
       if (verbose) printf(verb_str); \
       if (verbose) printf(verb_str); \
       temp_buffer = rindex (chld_out.line[i], ' '); \
       temp_buffer = rindex (chld_out.line[i], ' '); \
       addresses[n_addresses++] = check_new_address(temp_buffer); \
       addresses[n_addresses++] = check_new_address(temp_buffer); \
-      strncpy(query_found, querytype, sizeof(query_found)); \
-      query_found[sizeof(querytype)] = '\0';
+      memset(query_found, '\0', sizeof(query_found)); \
+      strncpy(query_found, querytype, sizeof(query_found)); 
 
 
 const char *progname = "check_dns";
 const char *progname = "check_dns";
 const char *copyright = "2000-2014";
 const char *copyright = "2000-2014";