+2023-06-02 Bruno Haible <bruno@clisp.org>
+
+ striconveha: Don't crash if malloc() returns NULL.
+ * lib/striconveha.c (mem_iconveha, str_iconveha): Check malloca() return
+ value.
+
2023-06-02 Bruno Haible <bruno@clisp.org>
setenv: Don't crash if malloc() returns NULL.
/* Character set conversion with error handling and autodetection.
- Copyright (C) 2002, 2005, 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2007, 2009-2023 Free Software Foundation, Inc.
Written by Bruno Haible.
This file is free software: you can redistribute it and/or modify
int retval;
size_t len = strlen (to_codeset);
char *to_codeset_suffixed = (char *) malloca (len + 10 + 1);
+ if (to_codeset_suffixed == NULL)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
memcpy (to_codeset_suffixed, to_codeset, len);
memcpy (to_codeset_suffixed + len, "//TRANSLIT", 10 + 1);
char *result;
size_t len = strlen (to_codeset);
char *to_codeset_suffixed = (char *) malloca (len + 10 + 1);
+ if (to_codeset_suffixed == NULL)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
memcpy (to_codeset_suffixed, to_codeset, len);
memcpy (to_codeset_suffixed + len, "//TRANSLIT", 10 + 1);