From: Razvan Becheriu Date: Thu, 8 Jun 2023 17:50:41 +0000 (+0300) Subject: [#2830] fixed UB for function pointer type X-Git-Tag: Kea-2.4.0~158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff6eaacd1b92700882a8628f3cf04193a7336e8f;p=thirdparty%2Fkea.git [#2830] fixed UB for function pointer type --- diff --git a/src/bin/dhcp4/tests/callout_library_1.cc b/src/bin/dhcp4/tests/callout_library_1.cc index c531bb998f..7c16b03c75 100644 --- a/src/bin/dhcp4/tests/callout_library_1.cc +++ b/src/bin/dhcp4/tests/callout_library_1.cc @@ -22,7 +22,7 @@ extern "C" { int (*do_load)(isc::hooks::LibraryHandle& handle); -int (*do_unload)(isc::hooks::LibraryHandle& handle); +int (*do_unload)(); /// @brief This function is called to retrieve the multi-threading compatibility. /// diff --git a/src/bin/dhcp4/tests/callout_library_2.cc b/src/bin/dhcp4/tests/callout_library_2.cc index d22b83a823..6059340272 100644 --- a/src/bin/dhcp4/tests/callout_library_2.cc +++ b/src/bin/dhcp4/tests/callout_library_2.cc @@ -19,6 +19,6 @@ extern "C" { int (*do_load)(isc::hooks::LibraryHandle& handle); -int (*do_unload)(isc::hooks::LibraryHandle& handle); +int (*do_unload)(); } diff --git a/src/bin/dhcp4/tests/callout_library_3.cc b/src/bin/dhcp4/tests/callout_library_3.cc index a08ab90311..6bd0fa3569 100644 --- a/src/bin/dhcp4/tests/callout_library_3.cc +++ b/src/bin/dhcp4/tests/callout_library_3.cc @@ -40,7 +40,7 @@ do_load_impl(LibraryHandle& handle) { int (*do_load)(isc::hooks::LibraryHandle& handle) = do_load_impl; -int (*do_unload)(isc::hooks::LibraryHandle& handle); +int (*do_unload)(); /// @brief Callout which appends library number and provided arguments to /// the marker file for dhcp4_srv_configured callout. diff --git a/src/bin/dhcp4/tests/callout_library_common.h b/src/bin/dhcp4/tests/callout_library_common.h index d16e4a71d9..0732019a14 100644 --- a/src/bin/dhcp4/tests/callout_library_common.h +++ b/src/bin/dhcp4/tests/callout_library_common.h @@ -35,7 +35,7 @@ extern "C" { extern int (*do_load)(isc::hooks::LibraryHandle& handle); -extern int (*do_unload)(isc::hooks::LibraryHandle& handle); +extern int (*do_unload)(); /// @brief Append digit to marker file /// @@ -98,11 +98,11 @@ load(isc::hooks::LibraryHandle& handle) { } int -unload(isc::hooks::LibraryHandle& handle) { +unload() { int result = 0; result = appendDigit(UNLOAD_MARKER_FILE); if (result == 0 && do_unload) { - result = do_unload(handle); + result = do_unload(); } return (result); } diff --git a/src/bin/dhcp6/tests/callout_library_1.cc b/src/bin/dhcp6/tests/callout_library_1.cc index cbb03c322f..356862b5d8 100644 --- a/src/bin/dhcp6/tests/callout_library_1.cc +++ b/src/bin/dhcp6/tests/callout_library_1.cc @@ -22,7 +22,7 @@ extern "C" { int (*do_load)(isc::hooks::LibraryHandle& handle); -int (*do_unload)(isc::hooks::LibraryHandle& handle); +int (*do_unload)(); /// @brief This function is called to retrieve the multi-threading compatibility. /// diff --git a/src/bin/dhcp6/tests/callout_library_2.cc b/src/bin/dhcp6/tests/callout_library_2.cc index bd7d1bfc84..12354e66cf 100644 --- a/src/bin/dhcp6/tests/callout_library_2.cc +++ b/src/bin/dhcp6/tests/callout_library_2.cc @@ -19,6 +19,6 @@ extern "C" { int (*do_load)(isc::hooks::LibraryHandle& handle); -int (*do_unload)(isc::hooks::LibraryHandle& handle); +int (*do_unload)(); } diff --git a/src/bin/dhcp6/tests/callout_library_3.cc b/src/bin/dhcp6/tests/callout_library_3.cc index eccaf8d6d5..c8e212eac0 100644 --- a/src/bin/dhcp6/tests/callout_library_3.cc +++ b/src/bin/dhcp6/tests/callout_library_3.cc @@ -39,7 +39,7 @@ do_load_impl(LibraryHandle& handle) { int (*do_load)(isc::hooks::LibraryHandle& handle) = do_load_impl; -int (*do_unload)(isc::hooks::LibraryHandle& handle); +int (*do_unload)(); /// @brief Callout which appends library number and provided arguments to /// the marker file for dhcp6_srv_configured callout. diff --git a/src/bin/dhcp6/tests/callout_library_common.h b/src/bin/dhcp6/tests/callout_library_common.h index 54efc8dfc6..d3c6d94b77 100644 --- a/src/bin/dhcp6/tests/callout_library_common.h +++ b/src/bin/dhcp6/tests/callout_library_common.h @@ -35,7 +35,7 @@ extern "C" { extern int (*do_load)(isc::hooks::LibraryHandle& handle); -extern int (*do_unload)(isc::hooks::LibraryHandle& handle); +extern int (*do_unload)(); /// @brief Append digit to marker file /// @@ -98,11 +98,11 @@ load(isc::hooks::LibraryHandle& handle) { } int -unload(isc::hooks::LibraryHandle& handle) { +unload() { int result = 0; result = appendDigit(UNLOAD_MARKER_FILE); if (result == 0 && do_unload) { - result = do_unload(handle); + result = do_unload(); } return (result); }