X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppstats%2Fpppstats.c;h=843f7eaa6247e37b64bfe049b67df2f04edf839d;hp=46cb9c24942b5e6869fef31f463b514daefb99ba;hb=d00f8a0e184cc73b1ca33a9b22c1b1f87292a72f;hpb=12fc6939987bc20feff22aadd82dff1a623d892b diff --git a/pppstats/pppstats.c b/pppstats/pppstats.c index 46cb9c2..843f7ea 100644 --- a/pppstats/pppstats.c +++ b/pppstats/pppstats.c @@ -149,7 +149,8 @@ get_ppp_stats(curp) #define ifr_name ifr__name #endif - strncpy(req.ifr_name, interface, sizeof(req.ifr_name)); + strncpy(req.ifr_name, interface, IFNAMSIZ); + req.ifr_name[IFNAMSIZ - 1] = 0; if (ioctl(s, SIOCGPPPSTATS, &req) < 0) { fprintf(stderr, "%s: ", progname); if (errno == ENOTTY) @@ -175,7 +176,8 @@ get_ppp_cstats(csp) #define ifr_name ifr__name #endif - strncpy(creq.ifr_name, interface, sizeof(creq.ifr_name)); + strncpy(creq.ifr_name, interface, IFNAMSIZ); + creq.ifr_name[IFNAMSIZ - 1] = 0; if (ioctl(s, SIOCGPPPCSTATS, &creq) < 0) { fprintf(stderr, "%s: ", progname); if (errno == ENOTTY) { @@ -521,7 +523,8 @@ main(argc, argv) #undef ifr_name #define ifr_name ifr_ifrn.ifrn_name #endif - strncpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, interface, IFNAMSIZ); + ifr.ifr_name[IFNAMSIZ - 1] = 0; if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) { fprintf(stderr, "%s: nonexistent interface '%s' specified\n", progname, interface);