To: vim_dev@googlegroups.com Subject: Patch 8.1.1889 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1889 Problem: Coverity warns for using a NULL pointer. Solution: Use zero for column if pos is NULL. Files: src/netbeans.c *** ../vim-8.1.1888/src/netbeans.c 2019-05-28 23:08:12.068648696 +0200 --- src/netbeans.c 2019-08-19 20:03:44.705561824 +0200 *************** *** 1389,1405 **** && ((pos != NULL && pos->col > 0) || (lnum == 1 && buf_was_empty))) { ! char_u *oldline = ml_get(lnum); ! char_u *newline; /* Insert halfway a line. */ newline = alloc(STRLEN(oldline) + len + 1); if (newline != NULL) { ! mch_memmove(newline, oldline, (size_t)pos->col); ! newline[pos->col] = NUL; STRCAT(newline, args); ! STRCAT(newline, oldline + pos->col); ml_replace(lnum, newline, FALSE); } } --- 1389,1406 ---- && ((pos != NULL && pos->col > 0) || (lnum == 1 && buf_was_empty))) { ! char_u *oldline = ml_get(lnum); ! char_u *newline; ! int col = pos == NULL ? 0 : pos->col; /* Insert halfway a line. */ newline = alloc(STRLEN(oldline) + len + 1); if (newline != NULL) { ! mch_memmove(newline, oldline, (size_t)col); ! newline[col] = NUL; STRCAT(newline, args); ! STRCAT(newline, oldline + col); ml_replace(lnum, newline, FALSE); } } *** ../vim-8.1.1888/src/version.c 2019-08-18 23:01:33.725885954 +0200 --- src/version.c 2019-08-19 20:04:20.717407523 +0200 *************** *** 767,768 **** --- 767,770 ---- { /* Add new patch number below this line */ + /**/ + 1889, /**/ -- From "know your smileys": :-)-O Smiling doctor with stethoscope /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///