Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/nohup use bounded string op



details:   https://anonhg.NetBSD.org/src/rev/d71903dd54ee
branches:  trunk
changeset: 549427:d71903dd54ee
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jul 14 09:31:16 2003 +0000

description:
use bounded string op

diffstat:

 usr.bin/nohup/nohup.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r 40199ebcee14 -r d71903dd54ee usr.bin/nohup/nohup.c
--- a/usr.bin/nohup/nohup.c     Mon Jul 14 09:30:52 2003 +0000
+++ b/usr.bin/nohup/nohup.c     Mon Jul 14 09:31:16 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nohup.c,v 1.10 2001/09/16 16:34:43 wiz Exp $   */
+/*     $NetBSD: nohup.c,v 1.11 2003/07/14 09:31:16 itojun Exp $        */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)nohup.c    5.4 (Berkeley) 6/1/90";
 #endif
-__RCSID("$NetBSD: nohup.c,v 1.10 2001/09/16 16:34:43 wiz Exp $");
+__RCSID("$NetBSD: nohup.c,v 1.11 2003/07/14 09:31:16 itojun Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -124,9 +124,9 @@
        if ((fd = open(p, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR)) >= 0)
                goto dupit;
        if ((p = getenv("HOME")) != NULL) {
-               (void)strcpy(path, p);
-               (void)strcat(path, "/");
-               (void)strcat(path, FILENAME);
+               (void)strlcpy(path, p, sizeof(path));
+               (void)strlcat(path, "/", sizeof(path));
+               (void)strlcat(path, FILENAME, sizeof(path));
                if ((fd = open(p = path, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR)) >= 0)
                        goto dupit;
        }



Home | Main Index | Thread Index | Old Index