Source-Changes-HG archive

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

[src/pkgviews]: src/usr.sbin/pkg_install Sync to HEAD for bounded string ops ...



details:   https://anonhg.NetBSD.org/src/rev/e7ec6f4f1900
branches:  pkgviews
changeset: 534231:e7ec6f4f1900
user:      jlam <jlam%NetBSD.org@localhost>
date:      Wed Jul 23 20:48:00 2003 +0000

description:
Sync to HEAD for bounded string ops changes.

diffstat:

 usr.sbin/pkg_install/add/extract.c  |  12 ++++++------
 usr.sbin/pkg_install/add/main.c     |   6 +++---
 usr.sbin/pkg_install/add/perform.c  |  14 +++++++-------
 usr.sbin/pkg_install/create/main.c  |   6 +++---
 usr.sbin/pkg_install/create/pl.c    |   7 ++++---
 usr.sbin/pkg_install/info/perform.c |  10 +++++-----
 usr.sbin/pkg_install/lib/file.c     |   6 +++---
 usr.sbin/pkg_install/lib/ftpio.c    |   6 +++---
 usr.sbin/pkg_install/lib/pen.c      |  22 +++++++++++-----------
 usr.sbin/pkg_install/lib/plist.c    |   6 +++---
 10 files changed, 48 insertions(+), 47 deletions(-)

diffs (truncated from 375 to 300 lines):

diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/add/extract.c
--- a/usr.sbin/pkg_install/add/extract.c        Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/add/extract.c        Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: extract.c,v 1.23.4.1 2003/07/13 09:45:20 jlam Exp $    */
+/*     $NetBSD: extract.c,v 1.23.4.2 2003/07/23 20:48:00 jlam Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
 #else
-__RCSID("$NetBSD: extract.c,v 1.23.4.1 2003/07/13 09:45:20 jlam Exp $");
+__RCSID("$NetBSD: extract.c,v 1.23.4.2 2003/07/23 20:48:00 jlam Exp $");
 #endif
 #endif
 
@@ -51,15 +51,15 @@
 
 #define PUSHOUT(todir) /* push out string */                           \
         if (where_count > sizeof(TAR_CMD) + sizeof(TAR_ARGS)-1) {              \
-                   strcat(where_args, TARX_CMD);                       \
-                   strcat(where_args, todir);                          \
+                   strlcat(where_args, TARX_CMD, maxargs);             \
+                   strlcat(where_args, todir, maxargs);                \
                    if (system(where_args)) {                           \
                        cleanup(0);                                     \
                        errx(2, "can not invoke %lu byte %s pipeline: %s", \
                                (u_long)strlen(where_args), TAR_CMD,    \
                                where_args);                            \
                    }                                                   \
-                   strcpy(where_args, TAR_CMD TAR_ARGS);                       \
+                   strlcpy(where_args, TAR_CMD TAR_ARGS, maxargs);     \
                    where_count = strlen(where_args);                   \
        }                                                               \
        if (perm_count) {                                               \
@@ -118,7 +118,7 @@
                cleanup(0);
                errx(2, "can't get argument list space");
        }
-       strcpy(where_args, TAR_CMD TAR_ARGS);
+       strlcpy(where_args, TAR_CMD TAR_ARGS, maxargs);
        /*
         * we keep track of how many characters are stored in 'where_args' with 'where_count'.
         * Note this doesn't include the trailing null character.
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/add/main.c
--- a/usr.sbin/pkg_install/add/main.c   Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/add/main.c   Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.25.2.1 2003/07/13 09:45:20 jlam Exp $       */
+/*     $NetBSD: main.c,v 1.25.2.2 2003/07/23 20:48:00 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.25.2.1 2003/07/13 09:45:20 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.25.2.2 2003/07/23 20:48:00 jlam Exp $");
 #endif
 #endif
 
@@ -102,7 +102,7 @@
                        break;
 
                case 't':
-                       strcpy(FirstPen, optarg);
+                       strlcpy(FirstPen, optarg, sizeof(FirstPen));
                        break;
 
                case 'S':
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/add/perform.c
--- a/usr.sbin/pkg_install/add/perform.c        Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/add/perform.c        Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.70.2.1 2003/07/13 09:45:21 jlam Exp $    */
+/*     $NetBSD: perform.c,v 1.70.2.2 2003/07/23 20:48:00 jlam Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.70.2.1 2003/07/13 09:45:21 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.70.2.2 2003/07/23 20:48:00 jlam Exp $");
 #endif
 #endif
 
@@ -118,7 +118,7 @@
        errc = 0;
        zapLogDir = 0;
        LogDir[0] = '\0';
-       strcpy(playpen, FirstPen);
+       strlcpy(playpen, FirstPen, sizeof(playpen));
        inPlace = 0;
        dbdir = (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR;
 
@@ -374,7 +374,7 @@
                                                                 *  to see if we want to compare against that
                                                                 *  one at all. 
                                                                 */
-                                                               strcpy(base_new, PkgName);
+                                                               strlcpy(base_new, PkgName, sizeof(base_new));
                                                                s2 = strpbrk(base_new, "<>[]?*{");
                                                                if (s2)
                                                                        *s2 = '\0';
@@ -383,7 +383,7 @@
                                                                        if (s2)
                                                                                *s2 = '\0';
                                                                }
-                                                               strcpy(base_exist, depp->name);
+                                                               strlcpy(base_exist, depp->name, sizeof(base_exist));
                                                                s2 = strpbrk(base_exist, "<>[]?*{");
                                                                if (s2)
                                                                        *s2 = '\0';
@@ -708,8 +708,8 @@
                                        /* this shouldn't happen... X-) */
                                }
                        }
-                       strcat(contents, "/");
-                       strcat(contents, REQUIRED_BY_FNAME);
+                       strlcat(contents, "/", sizeof(contents));
+                       strlcat(contents, REQUIRED_BY_FNAME, sizeof(contents));
 
                        cfile = fopen(contents, "a");
                        if (!cfile)
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/create/main.c
--- a/usr.sbin/pkg_install/create/main.c        Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/create/main.c        Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.21.2.1 2003/07/13 09:45:22 jlam Exp $       */
+/*     $NetBSD: main.c,v 1.21.2.2 2003/07/23 20:48:01 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.21.2.1 2003/07/13 09:45:22 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.21.2.2 2003/07/23 20:48:01 jlam Exp $");
 #endif
 #endif
 
@@ -142,7 +142,7 @@
                        break;
 
                case 't':
-                       strcpy(PlayPen, optarg);
+                       strlcpy(PlayPen, optarg, sizeof(PlayPen));
                        break;
 
                case 'X':
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/create/pl.c
--- a/usr.sbin/pkg_install/create/pl.c  Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/create/pl.c  Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: pl.c,v 1.22.4.1 2003/07/13 09:45:23 jlam Exp $ */
+/*     $NetBSD: pl.c,v 1.22.4.2 2003/07/23 20:48:01 jlam Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp";
 #else
-__RCSID("$NetBSD: pl.c,v 1.22.4.1 2003/07/13 09:45:23 jlam Exp $");
+__RCSID("$NetBSD: pl.c,v 1.22.4.2 2003/07/23 20:48:01 jlam Exp $");
 #endif
 #endif
 
@@ -201,7 +201,8 @@
                                warnx("Warning - block special device `%s' in PLIST", name);
                                break;
                        default:
-                               (void) strcpy(buf, CHECKSUM_HEADER);
+                               (void) strlcpy(buf, CHECKSUM_HEADER,
+                                   sizeof(buf));
                                if (MD5File(name, &buf[ChecksumHeaderLen]) != (char *) NULL) {
                                        tmp = new_plist_entry();
                                        tmp->name = strdup(buf);
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/info/perform.c
--- a/usr.sbin/pkg_install/info/perform.c       Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/info/perform.c       Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.40.2.1 2003/07/13 09:45:25 jlam Exp $    */
+/*     $NetBSD: perform.c,v 1.40.2.2 2003/07/23 20:48:01 jlam Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.40.2.1 2003/07/13 09:45:25 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.40.2.2 2003/07/23 20:48:01 jlam Exp $");
 #endif
 #endif
 
@@ -54,7 +54,7 @@
 
        if (IS_URL(pkg)) {
                if ((cp = fileGetURL(pkg)) != NULL) {
-                       strcpy(fname, cp);
+                       strlcpy(fname, cp, sizeof(fname));
                        isTMP = TRUE;
                }
        } else if (fexists(pkg) && isfile(pkg)) {
@@ -68,7 +68,7 @@
                        len = strlen(fname);
                        (void) snprintf(&fname[len], sizeof(fname) - len, "/%s", pkg);
                } else {
-                       strcpy(fname, pkg);
+                       strlcpy(fname, pkg, sizeof(fname));
                }
                cp = fname;
        } else {
@@ -89,7 +89,7 @@
                                char *cp2;
 
                                if ((cp2 = fileGetURL(cp)) != NULL) {
-                                       strcpy(fname, cp2);
+                                       strlcpy(fname, cp2, sizeof(fname));
                                        isTMP = TRUE;
                                }
                                strcpy(PlayPen, cp2);
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/lib/file.c
--- a/usr.sbin/pkg_install/lib/file.c   Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/lib/file.c   Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: file.c,v 1.55.2.1 2003/07/13 09:45:26 jlam Exp $       */
+/*     $NetBSD: file.c,v 1.55.2.2 2003/07/23 20:48:02 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
 #else
-__RCSID("$NetBSD: file.c,v 1.55.2.1 2003/07/13 09:45:26 jlam Exp $");
+__RCSID("$NetBSD: file.c,v 1.55.2.2 2003/07/23 20:48:02 jlam Exp $");
 #endif
 #endif
 
@@ -541,7 +541,7 @@
                        errx(EXIT_FAILURE, "don't know how to decompress %s, sorry", pkg);
        } else
                decompress_cmd = GZIP_CMD " -c -d";
-       strcat(args, "xpf -");
+       strlcat(args, "xpf -", sizeof(args));
        if (vsystem("%s %s | %s %s %s", decompress_cmd, pkg, TAR_CMD, args, flist ? flist : "")) {
                warnx("%s extract of %s failed!", TAR_CMD, pkg);
                return 1;
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/lib/ftpio.c
--- a/usr.sbin/pkg_install/lib/ftpio.c  Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/lib/ftpio.c  Wed Jul 23 20:48:00 2003 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: ftpio.c,v 1.41.2.1 2003/07/13 09:45:27 jlam Exp $      */
+/*     $NetBSD: ftpio.c,v 1.41.2.2 2003/07/23 20:48:02 jlam Exp $      */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.41.2.1 2003/07/13 09:45:27 jlam Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.41.2.2 2003/07/23 20:48:02 jlam Exp $");
 #endif
 
 /*
@@ -548,7 +548,7 @@
        char best[FILENAME_MAX];
        int tfd;
 
-       strcpy(tmpname, "/var/tmp/pkg.XXXXXX");
+       strlcpy(tmpname, "/var/tmp/pkg.XXXXXX", sizeof(tmpname));
        tfd=mkstemp(tmpname);
        if (tfd == -1) {
                warnx("Cannot generate temp file for ftp(1)'s nlist output");
diff -r 47a7e25c1577 -r e7ec6f4f1900 usr.sbin/pkg_install/lib/pen.c
--- a/usr.sbin/pkg_install/lib/pen.c    Tue Jul 15 20:59:39 2003 +0000
+++ b/usr.sbin/pkg_install/lib/pen.c    Wed Jul 23 20:48:00 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: pen.c,v 1.22.2.1 2003/07/13 09:45:28 jlam Exp $        */
+/*     $NetBSD: pen.c,v 1.22.2.2 2003/07/23 20:48:02 jlam Exp $        */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
 #else
-__RCSID("$NetBSD: pen.c,v 1.22.2.1 2003/07/13 09:45:28 jlam Exp $");
+__RCSID("$NetBSD: pen.c,v 1.22.2.2 2003/07/23 20:48:02 jlam Exp $");
 #endif
 #endif
 
@@ -65,11 +65,11 @@
 restore_dirs(char *c, char *p)
 {
        CurrentSet = 0;         /* prevent from deleting */
-       strcpy(Current, c);
+       strlcpy(Current, c, sizeof(Current));
        CurrentSet = 1;         /* rm -fr Current is safe now */
        free(c);
        
-       strcpy(Previous, p);
+       strlcpy(Previous, p, sizeof(Previous));



Home | Main Index | Thread Index | Old Index