]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#851,!24-p] Make sure that string is null terminated after strncpy.
authorMarcin Siodelski <marcin@isc.org>
Thu, 22 Aug 2019 18:40:27 +0000 (20:40 +0200)
committerMarcin Siodelski <marcin@isc.org>
Thu, 22 Aug 2019 18:40:27 +0000 (20:40 +0200)
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/util/io/socketsession.cc

index 7963213e79c9f84f8cc64cdca79321b6084039ef..4eddbdc68dd82ecffa024eed9da150407d3c2f0d 100644 (file)
@@ -119,6 +119,7 @@ public:
         memset(user_context_, 0, sizeof(user_context_));
         memset(dhcp4_server_hostname_, 0, sizeof(dhcp4_server_hostname_));
         memset(dhcp4_boot_file_name_, 0, sizeof(dhcp4_boot_file_name_));
+        memset(auth_key_, 0, sizeof(auth_key_));
 
         // Set the column names for use by this class. This only comprises
         // names used by the MySqlHostExchange class. Derived classes will
index c19ab450f1e0d4209243eba8fe2e957c5ad43200..ff51debc8d99ba238a7dc4fe4c2421b0c9ac5ed4 100644 (file)
@@ -102,6 +102,7 @@ SocketSessionForwarder::SocketSessionForwarder(const std::string& unix_file) :
     // the copy should be safe due to the above check, but we'd be rather
     // paranoid about making it 100% sure even if the check has a bug (with
     // triggering the assertion in the worse case)
+    memset(&impl.sock_un_.sun_path, 0, sizeof(impl.sock_un_.sun_path));
     strncpy(impl.sock_un_.sun_path, unix_file.c_str(),
             sizeof(impl.sock_un_.sun_path) - 1);
     assert(impl.sock_un_.sun_path[sizeof(impl.sock_un_.sun_path) - 1] == '\0');