From 981887b97039e468b50a78b103caf4734f5271d5 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Tue, 16 Jan 2018 20:35:54 +0000 Subject: [PATCH] utf8_to_ucs2() should check for malloc failure utf8_to_ucs2() is calling malloc() without checking the result. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D13933 --- stand/efi/libefi/efichar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/efi/libefi/efichar.c b/stand/efi/libefi/efichar.c index e5e57741c49a..233027f4e6ea 100644 --- a/stand/efi/libefi/efichar.c +++ b/stand/efi/libefi/efichar.c @@ -139,6 +139,8 @@ utf8_to_ucs2(const char *name, efi_char **nmp, size_t *len) sz = strlen(name) * 2 + 2; if (*nmp == NULL) *nmp = malloc(sz); + if (*nmp == NULL) + return (ENOMEM); nm = *nmp; *len = sz;