From: Richard Genoud Date: Tue, 3 Nov 2020 11:11:08 +0000 (+0100) Subject: fs/squashfs: sqfs_concat_tokens: check if malloc succeeds X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=dc3312c43c82ff9335b2bf4ee4f72365e824adfd;p=u-boot.git fs/squashfs: sqfs_concat_tokens: check if malloc succeeds memory allocation should always be checked Reviewed-by: Joao Marcos Costa Signed-off-by: Richard Genoud --- diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 72181f3833..7da2e09cc3 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -242,6 +242,9 @@ static char *sqfs_concat_tokens(char **token_list, int token_count) length = sqfs_get_tokens_length(token_list, token_count); result = malloc(length + 1); + if (!result) + return NULL; + result[length] = '\0'; for (i = 0; i < token_count; i++) {