[PC-BSD Commits] r2066 - pcbsd/trunk/libpcbsd

svn at pcbsd.org svn at pcbsd.org
Mon Jun 9 08:31:33 PDT 2008


Author: tim
Date: 2008-06-09 08:31:33 -0700 (Mon, 09 Jun 2008)
New Revision: 2066

Modified:
   pcbsd/trunk/libpcbsd/netif.cpp
Log:
Ensure structures are cleaned before use

Modified: pcbsd/trunk/libpcbsd/netif.cpp
===================================================================
--- pcbsd/trunk/libpcbsd/netif.cpp	2008-06-09 15:29:25 UTC (rev 2065)
+++ pcbsd/trunk/libpcbsd/netif.cpp	2008-06-09 15:31:33 UTC (rev 2066)
@@ -41,6 +41,7 @@
 {
    QStringList result;
    struct ifaddrs *ifap;
+   memset(&ifap, 0, sizeof(struct ifaddrs));
    getifaddrs(&ifap);
    char ifName[IFNAMSIZ];
    
@@ -63,6 +64,7 @@
 QString NetworkInterface::ipAsString()
 {
    struct ifreq ifr;
+   memset(&ifr, 0, sizeof(struct ifreq));
 
    strncpy(ifr.ifr_name, name, IFNAMSIZ);
    int s = socket(PF_INET, SOCK_DGRAM, 0);
@@ -76,6 +78,7 @@
 QString NetworkInterface::netmaskAsString()
 {
    struct ifreq ifr;
+   memset(&ifr, 0, sizeof(struct ifreq));
 
    strncpy(ifr.ifr_name, name, IFNAMSIZ);
    int s = socket(PF_INET, SOCK_DGRAM, 0);



More information about the Commits mailing list