]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
xgetXXbyYY: Handle DUP_FUNCTION failure
authorSamanta Navarro <ferivoz@riseup.net>
Mon, 15 May 2023 11:58:04 +0000 (11:58 +0000)
committerSerge Hallyn <serge@hallyn.com>
Fri, 26 May 2023 21:03:27 +0000 (16:03 -0500)
A failure of DUP_FUNCTION is already handled for non-reentrant
function wrapper. Perform the check for reentrant version as well.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
libmisc/xgetXXbyYY.c

index e1bf70f67c6bdeaa7135efe48de227ccaf71bf6e..11e80e27c86a7475145318b9cd39dd3b405c254c 100644 (file)
                        /* Build a result structure that can be freed by
                         * the shadow *_free functions. */
                        LOOKUP_TYPE *ret_result = DUP_FUNCTION(result);
+                       if (NULL == result) {
+                               fprintf (log_get_logfd(),
+                                        _("%s: out of memory\n"),
+                                        "x" STRINGIZE(FUNCTION_NAME));
+                               exit (13);
+                       }
                        free(buffer);
                        free(result);
                        return ret_result;