To: vim_dev@googlegroups.com Subject: Patch 8.1.0944 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0944 Problem: Format of nbdbg() arguments is not checked. Solution: Add format attribute. Fix reported problems. (Dominique Pelle, closes #3992) Files: src/nbdebug.h, src/netbeans.c *** ../vim-8.1.0943/src/nbdebug.h 2016-08-29 22:42:20.000000000 +0200 --- src/nbdebug.h 2019-02-17 19:10:08.447050070 +0100 *************** *** 42,48 **** } WtWait; ! void nbdbg(char *, ...); void nbdebug_wait(u_int wait_flags, char *wait_var, u_int wait_secs); void nbdebug_log_init(char *log_var, char *level_var); --- 42,52 ---- } WtWait; ! void nbdbg(char *, ...) ! #ifdef USE_PRINTF_FORMAT_ATTRIBUTE ! __attribute__((format(printf, 1, 2))) ! #endif ! ; void nbdebug_wait(u_int wait_flags, char *wait_var, u_int wait_secs); void nbdebug_log_init(char *log_var, char *level_var); *** ../vim-8.1.0943/src/netbeans.c 2019-02-17 17:44:36.215875493 +0100 --- src/netbeans.c 2019-02-17 19:10:08.451050047 +0100 *************** *** 934,940 **** { mch_memmove(newtext, oldtext, first); STRMOVE(newtext + first, oldtext + lastbyte + 1); ! nbdebug((" NEW LINE %d: %s\n", lnum, newtext)); ml_replace(lnum, newtext, FALSE); } } --- 934,940 ---- { mch_memmove(newtext, oldtext, first); STRMOVE(newtext + first, oldtext + lastbyte + 1); ! nbdebug((" NEW LINE %ld: %s\n", lnum, newtext)); ml_replace(lnum, newtext, FALSE); } } *************** *** 1166,1172 **** return FAIL; } first = *pos; ! nbdebug((" FIRST POS: line %d, col %d\n", first.lnum, first.col)); pos = off2pos(buf->bufp, off+count-1); if (!pos) --- 1166,1172 ---- return FAIL; } first = *pos; ! nbdebug((" FIRST POS: line %ld, col %d\n", first.lnum, first.col)); pos = off2pos(buf->bufp, off+count-1); if (!pos) *************** *** 1178,1184 **** return FAIL; } last = *pos; ! nbdebug((" LAST POS: line %d, col %d\n", last.lnum, last.col)); del_from_lnum = first.lnum; del_to_lnum = last.lnum; --- 1178,1184 ---- return FAIL; } last = *pos; ! nbdebug((" LAST POS: line %ld, col %d\n", last.lnum, last.col)); del_from_lnum = first.lnum; del_to_lnum = last.lnum; *************** *** 1264,1270 **** } } ! nbdebug((" Deleting lines %d through %d\n", del_from_lnum, del_to_lnum)); curwin->w_cursor.lnum = del_from_lnum; curwin->w_cursor.col = 0; --- 1264,1270 ---- } } ! nbdebug((" Deleting lines %ld through %ld\n", del_from_lnum, del_to_lnum)); curwin->w_cursor.lnum = del_from_lnum; curwin->w_cursor.col = 0; *************** *** 1540,1546 **** { if (!buf->bufp->b_netbeans_file) { ! nbdebug(("E658: NetBeans connection lost for buffer %ld\n", buf->bufp->b_fnum)); semsg(_("E658: NetBeans connection lost for buffer %d"), buf->bufp->b_fnum); } --- 1540,1546 ---- { if (!buf->bufp->b_netbeans_file) { ! nbdebug(("E658: NetBeans connection lost for buffer %d\n", buf->bufp->b_fnum)); semsg(_("E658: NetBeans connection lost for buffer %d"), buf->bufp->b_fnum); } *** ../vim-8.1.0943/src/version.c 2019-02-17 18:59:07.114686682 +0100 --- src/version.c 2019-02-17 19:10:31.334922632 +0100 *************** *** 781,782 **** --- 781,784 ---- { /* Add new patch number below this line */ + /**/ + 944, /**/ -- Your company is doomed if your primary product is overhead transparencies. (Scott Adams - The Dilbert principle) /// 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 ///