diff options
Diffstat (limited to 'src/lib/libc/stdlib/setenv.c')
-rw-r--r-- | src/lib/libc/stdlib/setenv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c index 9060fdba88..10b55445f7 100644 --- a/src/lib/libc/stdlib/setenv.c +++ b/src/lib/libc/stdlib/setenv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: setenv.c,v 1.14 2012/09/23 16:08:04 jeremy Exp $ */ | 1 | /* $OpenBSD: setenv.c,v 1.15 2014/10/08 05:33:31 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1987 Regents of the University of California. | 3 | * Copyright (c) 1987 Regents of the University of California. |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -71,7 +71,7 @@ putenv(char *str) | |||
71 | for (P = environ; *P != NULL; P++) | 71 | for (P = environ; *P != NULL; P++) |
72 | ; | 72 | ; |
73 | cnt = P - environ; | 73 | cnt = P - environ; |
74 | P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2)); | 74 | P = reallocarray(lastenv, cnt + 2, sizeof(char *)); |
75 | if (!P) | 75 | if (!P) |
76 | return (-1); | 76 | return (-1); |
77 | if (lastenv != environ) | 77 | if (lastenv != environ) |
@@ -129,7 +129,7 @@ setenv(const char *name, const char *value, int rewrite) | |||
129 | for (P = environ; *P != NULL; P++) | 129 | for (P = environ; *P != NULL; P++) |
130 | ; | 130 | ; |
131 | cnt = P - environ; | 131 | cnt = P - environ; |
132 | P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2)); | 132 | P = reallocarray(lastenv, cnt + 2, sizeof(char *)); |
133 | if (!P) | 133 | if (!P) |
134 | return (-1); | 134 | return (-1); |
135 | if (lastenv != environ) | 135 | if (lastenv != environ) |