Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/pppd/pppd use strlcat



details:   https://anonhg.NetBSD.org/src/rev/e4e3dbe6ec60
branches:  trunk
changeset: 547386:e4e3dbe6ec60
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat May 17 21:00:57 2003 +0000

description:
use strlcat

diffstat:

 usr.sbin/pppd/pppd/options.c |  11 +++++------
 usr.sbin/pppd/pppd/pppd.h    |   4 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r 0585b295c7f3 -r e4e3dbe6ec60 usr.sbin/pppd/pppd/options.c
--- a/usr.sbin/pppd/pppd/options.c      Sat May 17 20:58:39 2003 +0000
+++ b/usr.sbin/pppd/pppd/options.c      Sat May 17 21:00:57 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.c,v 1.39 2003/05/16 18:15:34 itojun Exp $      */
+/*     $NetBSD: options.c,v 1.40 2003/05/17 21:00:57 itojun Exp $      */
 
 /*
  * options.c - handles option processing for PPP.
@@ -47,7 +47,7 @@
 #if 0
 #define RCSID  "Id: options.c,v 1.80 2001/03/12 22:56:12 paulus Exp "
 #else
-__RCSID("$NetBSD: options.c,v 1.39 2003/05/16 18:15:34 itojun Exp $");
+__RCSID("$NetBSD: options.c,v 1.40 2003/05/17 21:00:57 itojun Exp $");
 #endif
 #endif
 
@@ -1503,14 +1503,13 @@
 setdomain(argv)
     char **argv;
 {
-    gethostname(hostname, MAXNAMELEN);
+    gethostname(hostname, sizeof(hostname));
     if (**argv != 0) {
        if (**argv != '.')
-           strncat(hostname, ".", MAXNAMELEN - strlen(hostname));
+           strlcat(hostname, ".", sizeof(hostname));
        domain = hostname + strlen(hostname);
-       strncat(hostname, *argv, MAXNAMELEN - strlen(hostname));
+       strlcat(hostname, *argv, sizeof(hostname));
     }
-    hostname[MAXNAMELEN-1] = 0;
     return (1);
 }
 
diff -r 0585b295c7f3 -r e4e3dbe6ec60 usr.sbin/pppd/pppd/pppd.h
--- a/usr.sbin/pppd/pppd/pppd.h Sat May 17 20:58:39 2003 +0000
+++ b/usr.sbin/pppd/pppd/pppd.h Sat May 17 21:00:57 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pppd.h,v 1.23 2002/07/01 22:19:40 itojun Exp $ */
+/*     $NetBSD: pppd.h,v 1.24 2003/05/17 21:00:58 itojun Exp $ */
 
 /*
  * pppd.h - PPP daemon global declarations.
@@ -209,7 +209,7 @@
 extern int     hungup;         /* Physical layer has disconnected */
 extern int     ifunit;         /* Interface unit number */
 extern char    ifname[];       /* Interface name */
-extern char    hostname[];     /* Our hostname */
+extern char    hostname[MAXNAMELEN];   /* Our hostname */
 extern u_char  outpacket_buf[]; /* Buffer for outgoing packets */
 extern int     phase;          /* Current state of link - see values below */
 extern int     baud_rate;      /* Current link speed in bits/sec */



Home | Main Index | Thread Index | Old Index