2008-04-04 17:41:27 -04:00
|
|
|
$OpenBSD: patch-vpnc_c,v 1.3 2008/04/04 21:41:27 okan Exp $
|
|
|
|
--- vpnc.c.orig Mon Sep 10 15:39:48 2007
|
|
|
|
+++ vpnc.c Wed Sep 12 16:47:27 2007
|
|
|
|
@@ -159,10 +159,11 @@ static void addenv(const void *name, const char *value
|
2005-03-08 01:38:08 -05:00
|
|
|
|
2005-11-11 14:38:07 -05:00
|
|
|
oldval = getenv(name);
|
|
|
|
if (oldval != NULL) {
|
|
|
|
- strbuf = xallocc(strlen(oldval) + 1 + strlen(value) + 1);
|
|
|
|
- strcat(strbuf, oldval);
|
|
|
|
- strcat(strbuf, " ");
|
|
|
|
- strcat(strbuf, value);
|
|
|
|
+ size_t sz = strlen(oldval) + 1 + strlen(value) + 1;
|
|
|
|
+ strbuf = xallocc(sz);
|
|
|
|
+ strlcpy(strbuf, oldval, sz);
|
|
|
|
+ strlcat(strbuf, " ", sz);
|
|
|
|
+ strlcat(strbuf, value, sz);
|
2005-03-08 01:38:08 -05:00
|
|
|
}
|
|
|
|
|
2005-11-11 14:38:07 -05:00
|
|
|
setenv(name, strbuf ? strbuf : value, 1);
|