From: Christian Brabandt Date: Sun, 28 Jun 2026 18:53:06 +0000 (+0000) Subject: patch 9.2.0746: NULL pointer dereference in gui_photon X-Git-Tag: v9.2.0746^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38210a5c79b2104b52a8c0e7241f8f346ab6e693;p=thirdparty%2Fvim.git patch 9.2.0746: NULL pointer dereference in gui_photon Problem: NULL pointer dereference in gui_photon (Ao Xijie) Solution: after realloc() validate the buffer is not NULL. closes: #20661 Signed-off-by: Christian Brabandt --- diff --git a/src/gui_photon.c b/src/gui_photon.c index 8cc31d59ad..096f6ac54c 100644 --- a/src/gui_photon.c +++ b/src/gui_photon.c @@ -2173,7 +2173,11 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags) // Use a static buffer to avoid large amounts of de/allocations if (utf8_len < len) { - utf8_buffer = realloc(utf8_buffer, len * MB_LEN_MAX); + char *new_buffer = realloc(utf8_buffer, len * MB_LEN_MAX); + + if (new_buffer == NULL) + return; + utf8_buffer = new_buffer; utf8_len = len; } diff --git a/src/version.c b/src/version.c index c75668400b..bb33fb77c0 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 746, /**/ 745, /**/