]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
plugins/passprompt: Fix potential out-of-bounds array reference
[ppp.git] / pppd / sys-linux.c
index 67b50cb663fa827051dc4480116f72e259dfd516..72a7727c403f79762a93bf1342e3b02aa869c27a 100644 (file)
@@ -1658,6 +1658,8 @@ int cifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
     SET_SA_FAMILY (rt.rt_dst,     AF_INET);
     SET_SA_FAMILY (rt.rt_gateway, AF_INET);
 
+    rt.rt_dev = ifname;
+
     if (kernel_version > KVERSION(2,1,0)) {
        SET_SA_FAMILY (rt.rt_genmask, AF_INET);
        SIN_ADDR(rt.rt_genmask) = 0L;
@@ -2016,7 +2018,7 @@ ppp_registered(void)
 
 int ppp_available(void)
 {
-    int s, ok, fd, err;
+    int s, ok, fd;
     struct ifreq ifr;
     int    size;
     int    my_version, my_modification, my_patch;
@@ -2039,7 +2041,6 @@ int ppp_available(void)
        close(fd);
        return 1;
     }
-    err = errno;
 
     if (kernel_version >= KVERSION(2,3,13)) {
        error("Couldn't open the /dev/ppp device: %m");
@@ -2146,6 +2147,7 @@ int ppp_available(void)
     return ok;
 }
 
+#ifndef HAVE_LOGWTMP
 /********************************************************************
  *
  * Update the wtmp file with the appropriate user name and tty device.
@@ -2219,7 +2221,7 @@ void logwtmp (const char *line, const char *name, const char *host)
     }
 #endif
 }
-
+#endif /* HAVE_LOGWTMP */
 
 /********************************************************************
  *
@@ -2231,9 +2233,10 @@ int sifvjcomp (int u, int vjcomp, int cidcomp, int maxcid)
        u_int x;
 
        if (vjcomp) {
-               if (ioctl(ppp_dev_fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0)
+               if (ioctl(ppp_dev_fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) {
                        error("Couldn't set up TCP header compression: %m");
-               vjcomp = 0;
+                       vjcomp = 0;
+               }
        }
 
        x = (vjcomp? SC_COMP_TCP: 0) | (cidcomp? 0: SC_NO_TCP_CCID);
@@ -2876,7 +2879,7 @@ ether_to_eui64(eui64_t *p_eui64)
     /*
      * And convert the EUI-48 into EUI-64, per RFC 2472 [sec 4.1]
      */
-    ptr = ifr.ifr_hwaddr.sa_data;
+    ptr = (unsigned char *) ifr.ifr_hwaddr.sa_data;
     p_eui64->e8[0] = ptr[0] | 0x02;
     p_eui64->e8[1] = ptr[1];
     p_eui64->e8[2] = ptr[2];