From 7cc73a6c668e43b2018b145af235801e53b95b45 Mon Sep 17 00:00:00 2001 From: John Marriott Date: Wed, 15 Apr 2026 17:54:22 +0000 Subject: [PATCH] patch 9.2.0353: Missing out-of-memory check in register.c Problem: Missing out-of-memory check in register.c Solution: Check for memory allocation failure and return NULL (John Marriott). closes: #19949 Signed-off-by: John Marriott Signed-off-by: Christian Brabandt --- src/register.c | 10 ++++++++++ src/version.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/register.c b/src/register.c index a20e5c1d0f..0215f0153d 100644 --- a/src/register.c +++ b/src/register.c @@ -352,6 +352,16 @@ get_register( { reg->y_array[i].string = vim_strnsave(y_current->y_array[i].string, y_current->y_array[i].length); + if (reg->y_array[i].string == NULL) + { + // The allocation failed so clean up and exit + while (--i >= 0) + vim_free(reg->y_array[i].string); + vim_free(reg->y_array); + vim_free(reg); + return (void *)NULL; + } + reg->y_array[i].length = y_current->y_array[i].length; } } diff --git a/src/version.c b/src/version.c index 2eb306c56b..2f48f475e9 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 353, /**/ 352, /**/