diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2003-04-06 22:47:15 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2003-04-06 22:47:15 +0000 |
commit | 480e6f4b66ecde3ac8804e0d92e2fa768097af96 (patch) | |
tree | 939212e570e52fbb01c840b68150b5251f298b7b /usr.bin/make/arch.c | |
parent | 8c9ed37797045721315b3fcc5542502fbea40420 (diff) |
get rid of some strcpy/sprintf.
ok krw@, matthieu@, deraadt@
Diffstat (limited to 'usr.bin/make/arch.c')
-rw-r--r-- | usr.bin/make/arch.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 77bfe6f2ac6..ebbbf784b1a 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: arch.c,v 1.51 2002/01/30 18:40:26 matthieu Exp $ */ +/* $OpenBSD: arch.c,v 1.52 2003/04/06 22:47:14 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -313,15 +313,17 @@ Arch_ParseArchive(linePtr, nodeLst, ctxt) char *buf; char *sacrifice; char *oldMemName = memName; + size_t len; memName = Var_Subst(memName, ctxt, true); /* Now form an archive spec and recurse to deal with nested * variables and multi-word variable values.... The results * are just placed at the end of the nodeLst we're returning. */ - buf = sacrifice = emalloc(strlen(memName)+strlen(libName)+3); + len = strlen(memName)+strlen(libName)+3; + buf = sacrifice = emalloc(len); - sprintf(buf, "%s(%s)", libName, memName); + snprintf(buf, len, "%s(%s)", libName, memName); if (strchr(memName, '$') && strcmp(memName, oldMemName) == 0) { /* Must contain dynamic sources, so we can't deal with it now. @@ -974,9 +976,10 @@ Arch_FindLib(gn, path) Lst path; /* Search path */ { char *libName; /* file name for archive */ + size_t len = strlen(gn->name) + 6 - 2; - libName = emalloc(strlen(gn->name) + 6 - 2); - sprintf(libName, "lib%s.a", &gn->name[2]); + libName = emalloc(len); + snprintf(libName, len, "lib%s.a", &gn->name[2]); gn->path = Dir_FindFile(libName, path); |