To: vim_dev@googlegroups.com Subject: Patch 9.0.1405 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1405 Problem: Missing check for out-of-memory. Solution: Check for alloc() returning NULL pointer. (closes #12149) Files: src/option.c *** ../vim-9.0.1404/src/option.c 2023-03-12 21:20:51.437254187 +0000 --- src/option.c 2023-03-15 22:02:47.612205328 +0000 *************** *** 126,140 **** #endif int len; garray_T ga; ! int mustfree; ! char_u *item; opt_idx = findoption((char_u *)"backupskip"); ga_init2(&ga, 1, 100); for (n = 0; n < (long)ARRAY_LENGTH(names); ++n) { ! mustfree = FALSE; #ifdef UNIX if (*names[n] == NUL) # ifdef MACOS_X --- 126,139 ---- #endif int len; garray_T ga; ! char_u *item; opt_idx = findoption((char_u *)"backupskip"); ga_init2(&ga, 1, 100); for (n = 0; n < (long)ARRAY_LENGTH(names); ++n) { ! int mustfree = FALSE; #ifdef UNIX if (*names[n] == NUL) # ifdef MACOS_X *************** *** 150,168 **** // First time count the NUL, otherwise count the ','. len = (int)STRLEN(p) + 3; item = alloc(len); ! STRCPY(item, p); ! add_pathsep(item); ! STRCAT(item, "*"); ! if (find_dup_item(ga.ga_data, item, options[opt_idx].flags) ! == NULL ! && ga_grow(&ga, len) == OK) { ! if (ga.ga_len > 0) ! STRCAT(ga.ga_data, ","); ! STRCAT(ga.ga_data, item); ! ga.ga_len += len; } - vim_free(item); } if (mustfree) vim_free(p); --- 149,170 ---- // First time count the NUL, otherwise count the ','. len = (int)STRLEN(p) + 3; item = alloc(len); ! if (item != NULL) { ! STRCPY(item, p); ! add_pathsep(item); ! STRCAT(item, "*"); ! if (find_dup_item(ga.ga_data, item, options[opt_idx].flags) ! == NULL ! && ga_grow(&ga, len) == OK) ! { ! if (ga.ga_len > 0) ! STRCAT(ga.ga_data, ","); ! STRCAT(ga.ga_data, item); ! ga.ga_len += len; ! } ! vim_free(item); } } if (mustfree) vim_free(p); *** ../vim-9.0.1404/src/version.c 2023-03-15 17:08:46.377596515 +0000 --- src/version.c 2023-03-15 22:03:54.828118940 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1405, /**/ -- MAN: You don't frighten us, English pig-dog! Go and boil your bottoms, son of a silly person. I blow my nose on you, so-called Arthur-king, you and your silly English K...kaniggets. He puts hands to his ears and blows a raspberry. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///