X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppstats%2Fpppstats.c;h=843f7eaa6247e37b64bfe049b67df2f04edf839d;hb=388597eee99beac6e5b7430d24c377169f51bd57;hp=46cb9c24942b5e6869fef31f463b514daefb99ba;hpb=bbcdc4366bbee6c3f4e1ddda31e4eec8c1b3ccc2;p=ppp.git 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);