[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2003-10-19 19:08:50
[Download RAW message or body]

CVS commit by mutz: 

More gethostname usage fixes (I wonder how many of those still lurk on my HD...)


  M +5 -1      dcop/KDE-ICE/Xtransutil.c   1.7
  M +2 -1      kded/kded.cpp   1.86
  M +4 -2      kdeprint/management/kmwsocketutil.cpp   1.14
  M +3 -1      kdeprint/management/networkscanner.cpp   1.7
  M +1 -0      kinit/lnusertemp.c   1.13
  M +1 -0      kinit/wrapper.c   1.36


--- kdelibs/dcop/KDE-ICE/Xtransutil.c  #1.6:1.7
@@ -227,4 +227,5 @@ TRANS(GetMyNetworkId) (XtransConnInfo ci
         return (NULL);
     }
+    hostnamebuf[sizeof(hostnamebuf)-1] = '\0';
 
     switch (family)
@@ -316,6 +317,8 @@ TRANS(GetPeerNetworkId) (XtransConnInfo 
     case AF_UNIX:
     {
-        if (gethostname (addrbuf, sizeof (addrbuf)) == 0)
+        if (gethostname (addrbuf, sizeof (addrbuf)) == 0) {
+            addrbuf[sizeof(addrbuf)-1] = '\0';
             addr = addrbuf;
+        }
         break;
     }
@@ -388,4 +391,5 @@ TRANS(GetPeerNetworkId) (XtransConnInfo 
     {
         if (gethostname (addrbuf, sizeof (addrbuf)) == 0) {
+            addrbuf[sizeof(addrbuf)-1] = '\0';
             addr = addrbuf;
         } else {

--- kdelibs/kded/kded.cpp  #1.85:1.86
@@ -570,4 +570,5 @@ void KHostnameD::checkHostname()
     if (gethostname(buf, 1024) != 0)
        return;
+    buf[sizeof(buf)-1] = '\0';
 
     if (m_hostname.isEmpty())

--- kdelibs/kdeprint/management/kmwsocketutil.cpp  #1.13:1.14
@@ -198,5 +198,7 @@ QString localRootIP()
 {
         char    buf[256];
-        gethostname(buf, 255);
+        buf[0] = '\0';
+        if (!gethostname(buf, sizeof(buf)))
+                buf[sizeof(buf)-1] = '\0';
         QPtrList<KAddressInfo>  infos = KExtendedSocket::lookup(buf, QString::null);
         infos.setAutoDelete(true);

--- kdelibs/kdeprint/management/networkscanner.cpp  #1.6:1.7
@@ -72,5 +72,7 @@ QString NetworkScanner::NetworkScannerPr
 {
         char    buf[256];
-        gethostname(buf, 255);
+        buf[0] = '\0';
+        if (!gethostname(buf, sizeof(buf)))
+                buf[sizeof(buf)-1] = '\0';
         QPtrList<KAddressInfo>  infos = KExtendedSocket::lookup(buf, QString::null);
         infos.setAutoDelete(true);

--- kdelibs/kinit/lnusertemp.c  #1.12:1.13
@@ -162,4 +162,5 @@ int build_link(const char *tmp_prefix, c
      exit(255);
   }
+  kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0';
 
   result = lstat(kde_tmp_dir, &stat_buf);

--- kdelibs/kinit/wrapper.c  #1.35:1.36
@@ -169,4 +169,5 @@ static int openSocket()
      return -1;
   }
+  sock_file[sizeof(sock_file)-1] = '\0';
 
   /* append $DISPLAY */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic