summaryrefslogtreecommitdiffstats
path: root/gl/setenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/setenv.c')
-rw-r--r--gl/setenv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gl/setenv.c b/gl/setenv.c
index f0b8899..9e2e9e2 100644
--- a/gl/setenv.c
+++ b/gl/setenv.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1992, 1995-2003, 2005-2023 Free Software Foundation, Inc. 1/* Copyright (C) 1992, 1995-2003, 2005-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library. 2 This file is part of the GNU C Library.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
@@ -82,6 +82,7 @@ typedef int (*compar_fn_t) (const void *, const void *);
82static void *known_values; 82static void *known_values;
83 83
84# define KNOWN_VALUE(Str) \ 84# define KNOWN_VALUE(Str) \
85 __extension__ \
85 ({ \ 86 ({ \
86 void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ 87 void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \
87 value != NULL ? *(char **) value : NULL; \ 88 value != NULL ? *(char **) value : NULL; \
@@ -375,6 +376,11 @@ rpl_setenv (const char *name, const char *value, int replace)
375 int saved_errno; 376 int saved_errno;
376 size_t len = strlen (value); 377 size_t len = strlen (value);
377 tmp = malloca (len + 2); 378 tmp = malloca (len + 2);
379 if (tmp == NULL)
380 {
381 errno = ENOMEM;
382 return -1;
383 }
378 /* Since leading '=' is eaten, double it up. */ 384 /* Since leading '=' is eaten, double it up. */
379 *tmp = '='; 385 *tmp = '=';
380 memcpy (tmp + 1, value, len + 1); 386 memcpy (tmp + 1, value, len + 1);