]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1316: missing memory allocation failure in os_mswin.c v9.1.1316
authorJohn Marriott <basilisk@internode.on.net>
Thu, 17 Apr 2025 18:35:42 +0000 (20:35 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 17 Apr 2025 18:35:42 +0000 (20:35 +0200)
Problem:  missing memory allocation failure in os_mswin.c
Solution: check for memory allocation failure and return early.
          (John Marriott)

closes: #17134

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/os_mswin.c
src/proto/os_mswin.pro
src/version.c

index 485ee20afc084d1b0cf18c9b52012d2ef695e8d1..c47346033f025e6537d951c89723c5a711c9de21 100644 (file)
@@ -2307,16 +2307,20 @@ findServer(char_u *name)
     void
 serverSetName(char_u *name)
 {
+    size_t     namelen;
     char_u     *ok_name;
     HWND       hwnd = 0;
     int                i = 0;
     char_u     *p;
 
     // Leave enough space for a 9-digit suffix to ensure uniqueness!
-    ok_name = alloc(STRLEN(name) + 10);
+    namelen = STRLEN(name);
+    ok_name = alloc(namelen + 10);
+    if (ok_name == NULL)
+       return;
 
     STRCPY(ok_name, name);
-    p = ok_name + STRLEN(name);
+    p = ok_name + namelen;
 
     for (;;)
     {
index 055cf8cd3a8aad48c6a35c196ab2633090b22c56..e8e08d2ee5bcf63ae8aa3ad6b0677061fe4261c3 100644 (file)
@@ -1,4 +1,5 @@
 /* os_mswin.c */
+void SaveInst(HINSTANCE hInst);
 void mch_exit_g(int r);
 void mch_early_init(void);
 int mch_input_isatty(void);
index 9a1926004c5aaf551cb92e4f29372cc869407920..abd0fa3661898cad4f40be535aa6945058492e7f 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1316,
 /**/
     1315,
 /**/