use bounded string op as much as possible
This commit is contained in:
parent
97a29a12a2
commit
041bd7648a
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: extract.c,v 1.29 2003/02/02 12:59:53 abs Exp $ */
|
||||
/* $NetBSD: extract.c,v 1.30 2003/07/14 06:00:44 itojun 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.29 2003/02/02 12:59:53 abs Exp $");
|
||||
__RCSID("$NetBSD: extract.c,v 1.30 2003/07/14 06:00:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -51,15 +51,15 @@ __RCSID("$NetBSD: extract.c,v 1.29 2003/02/02 12:59:53 abs Exp $");
|
||||
|
||||
#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 @@ extract_plist(char *home, package_t *pkg)
|
||||
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.
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: perform.c,v 1.82 2003/04/23 10:02:23 seb Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.83 2003/07/14 06:00:44 itojun 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.82 2003/04/23 10:02:23 seb Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.83 2003/07/14 06:00:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -118,7 +118,7 @@ pkg_do(const char *pkg)
|
||||
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 @@ pkg_do(const char *pkg)
|
||||
* 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 @@ pkg_do(const char *pkg)
|
||||
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 @@ ignore_replace_depends_check:
|
||||
/* 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)
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* $NetBSD: file.c,v 1.61 2003/05/14 14:31:01 wiz Exp $ */
|
||||
/* $NetBSD: file.c,v 1.62 2003/07/14 06:00:45 itojun 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.61 2003/05/14 14:31:01 wiz Exp $");
|
||||
__RCSID("$NetBSD: file.c,v 1.62 2003/07/14 06:00:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -541,7 +541,7 @@ unpack(const char *pkg, const char *flist)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user