=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/netstat/route.c,v retrieving revision 1.21 retrieving revision 1.22 diff -c -r1.21 -r1.22 *** src/usr.bin/netstat/route.c 1998/02/26 10:06:13 1.21 --- src/usr.bin/netstat/route.c 1998/02/26 10:13:08 1.22 *************** *** 1,4 **** ! /* $OpenBSD: route.c,v 1.21 1998/02/26 10:06:13 peter Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: route.c,v 1.22 1998/02/26 10:13:08 deraadt Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* *************** *** 38,44 **** #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else ! static char *rcsid = "$OpenBSD: route.c,v 1.21 1998/02/26 10:06:13 peter Exp $"; #endif #endif /* not lint */ --- 38,44 ---- #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else ! static char *rcsid = "$OpenBSD: route.c,v 1.22 1998/02/26 10:13:08 deraadt Exp $"; #endif #endif /* not lint */ *************** *** 575,583 **** cp = hp->h_name; } } ! if (cp) strncpy(line, cp, sizeof(line) - 1); ! else { #define C(x) ((x) & 0xff) in = ntohl(in); sprintf(line, "%u.%u.%u.%u", --- 575,584 ---- cp = hp->h_name; } } ! if (cp) { strncpy(line, cp, sizeof(line) - 1); ! line[sizeof(line) - 1] = '\0'; ! } else { #define C(x) ((x) & 0xff) in = ntohl(in); sprintf(line, "%u.%u.%u.%u", *************** *** 607,615 **** cp = np->n_name; } mbits = mask ? 33 - ffs(mask) : 0; ! if (cp) strncpy(line, cp, sizeof(line) - 1); ! else if ((in & 0xffffff) == 0) sprintf(line, "%u/%d", C(in >> 24), mbits); else if ((in & 0xffff) == 0) sprintf(line, "%u.%u/%d", C(in >> 24) , C(in >> 16), mbits); --- 608,617 ---- cp = np->n_name; } mbits = mask ? 33 - ffs(mask) : 0; ! if (cp) { strncpy(line, cp, sizeof(line) - 1); ! line[sizeof(line) - 1] = '\0'; ! } else if ((in & 0xffffff) == 0) sprintf(line, "%u/%d", C(in >> 24), mbits); else if ((in & 0xffff) == 0) sprintf(line, "%u.%u/%d", C(in >> 24) , C(in >> 16), mbits);