summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/setenv.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2008-11-01 00:54:47 +0000
committerchristos <christos@NetBSD.org>2008-11-01 00:54:47 +0000
commit035a506da3e4ce3dee7748e7fd6ebc3f8c6d288b (patch)
treefa115a4822c16706f9f2ecd42ee6bd0857ed3b4f /lib/libc/stdlib/setenv.c
parent5ad9f5a30496bcfe95e63c6aa2e5198f2994919b (diff)
use the right variable in memcpy.
Diffstat (limited to 'lib/libc/stdlib/setenv.c')
-rw-r--r--lib/libc/stdlib/setenv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/setenv.c b/lib/libc/stdlib/setenv.c
index 0308944fd7d..5aaf627dd90 100644
--- a/lib/libc/stdlib/setenv.c
+++ b/lib/libc/stdlib/setenv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: setenv.c,v 1.30 2008/10/31 17:46:04 christos Exp $ */
+/* $NetBSD: setenv.c,v 1.31 2008/11/01 00:54:47 christos Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setenv.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: setenv.c,v 1.30 2008/10/31 17:46:04 christos Exp $");
+__RCSID("$NetBSD: setenv.c,v 1.31 2008/11/01 00:54:47 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -94,7 +94,7 @@ setenv(const char *name, const char *value, int rewrite)
free(saveenv);
if ((saveenv = malloc(size)) == NULL)
goto bad;
- (void)memcpy(saveenv, environ, offset - sizeof(char *));
+ (void)memcpy(saveenv, environ, size - sizeof(char *));
}
environ = saveenv;
environ[offset + 1] = NULL;