[monitoring-plugins] Use size_t instead of int when calling sysctl(3).

Sven Nierlein git at monitoring-plugins.org
Tue Jan 21 20:50:12 CET 2020


    Module: monitoring-plugins
    Branch: master
    Commit: 60ec4d29019c553451d828fe366c8acc46fc8162
    Author: Vadim Zhukov <persgray at gmail.com>
 Committer: Sven Nierlein <sven at nierlein.org>
      Date: Wed Jul 19 13:55:08 2017 +0300
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=60ec4d2

Use size_t instead of int when calling sysctl(3).

Otherwise, it writes sizeof(size_t) bytes to &oldlen, smashing the stack.

---

 plugins-root/check_dhcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index f4c2daf..ad67323 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -323,7 +323,8 @@ int get_hardware_address(int sock,char *interface_name){
 #elif defined(__bsd__)
 						/* King 2004	see ACKNOWLEDGEMENTS */
 
-        int                     mib[6], len;
+        size_t                  len;
+        int                     mib[6];
         char                    *buf;
         unsigned char           *ptr;
         struct if_msghdr        *ifm;



More information about the Commits mailing list