patch 9.1.1316: missing memory allocation failure in os_mswin.c
Commit:
https://github.com/vim/vim/commit/7ddba51635abdacb2bf8b96bff2ddfdefa0c985b
Author: John Marriott <[email protected]>
Date: Thu Apr 17 20:35:42 2025 +0200
patch 9.1.1316: missing memory allocation failure in os_mswin.c
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 485ee20af..c47346033 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -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 (;;)
{
diff --git a/src/proto/os_mswin.pro b/src/proto/os_mswin.pro
index 055cf8cd3..e8e08d2ee 100644
--- a/src/proto/os_mswin.pro
+++ b/src/proto/os_mswin.pro
@@ -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);
diff --git a/src/version.c b/src/version.c
index 9a1926004..abd0fa366 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1316,
/**/
1315,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1u5UER-008z0f-2n%40256bit.org.