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

Otherwise, it writes sizeof(size_t) bytes to &oldlen, smashing the stack.
This commit is contained in:
Vadim Zhukov 2017-07-19 13:55:08 +03:00 committed by Sven Nierlein
parent f53ea7afd8
commit 60ec4d2901

View file

@ -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;