summaryrefslogtreecommitdiff
path: root/compat/setenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/setenv.c')
-rw-r--r--compat/setenv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/setenv.c b/compat/setenv.c
index fc1439a643..7849f258d2 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -18,7 +18,7 @@ int gitsetenv(const char *name, const char *value, int replace)
namelen = strlen(name);
valuelen = strlen(value);
- envstr = malloc((namelen + valuelen + 2));
+ envstr = malloc(st_add3(namelen, valuelen, 2));
if (!envstr) {
errno = ENOMEM;
return -1;