bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setenv, striconveha: Don't crash if malloc() returns NULL


From: Bruno Haible
Subject: setenv, striconveha: Don't crash if malloc() returns NULL
Date: Fri, 02 Jun 2023 20:23:21 +0200

The gcc 13 -Wanalyzer-possible-null-argument warning option reported a couple
of bugs in GNU gettext. No false positives on this one. I can therefore
highly recommend it.

One of the warnings is:

gettext-tools/gnulib-lib/striconveha.c:339:7: warning: use of possibly-NULL 
'to_codeset_suffixed' where non-null expected [CWE-690]

Evidently there is a missing NULL check for the malloca() return value here,
and elsewhere as well. I'm applying these two fixes.


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.
        * lib/setenv.c (rpl_setenv): Check malloca() return value.

Attachment: 0001-setenv-Don-t-crash-if-malloc-returns-NULL.patch
Description: Text Data

Attachment: 0002-striconveha-Don-t-crash-if-malloc-returns-NULL.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]