To: vim_dev@googlegroups.com Subject: Patch 8.1.0954 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0954 Problem: Arguments of semsg() and siemsg() are not checked. Solution: Add function prototype with __attribute__. Files: src/message.c, src/proto/message.pro, src/proto.h *** ../vim-8.1.0953/src/message.c 2019-02-17 17:44:36.215875493 +0100 --- src/message.c 2019-02-19 21:28:21.094091607 +0100 *************** *** 730,735 **** --- 730,736 ---- return TRUE; /* no error messages at the moment */ } + #ifndef PROTO // manual proto with __attribute__ /* * Print an error message with format string and variable arguments. * Note: caller must not pass 'IObuff' as 1st argument. *************** *** 749,754 **** --- 750,756 ---- } return TRUE; /* no error messages at the moment */ } + #endif /* * Same as emsg(...), but abort on error when ABORT_ON_INTERNAL_ERROR is *************** *** 765,770 **** --- 767,773 ---- #endif } + #ifndef PROTO // manual proto with __attribute__ /* * Same as semsg(...) but abort on error when ABORT_ON_INTERNAL_ERROR is * defined. It is used for internal errors only, so that they can be *************** *** 783,792 **** va_end(ap); emsg_core(IObuff); } ! #ifdef ABORT_ON_INTERNAL_ERROR abort(); ! #endif } /* * Give an "Internal error" message. --- 786,796 ---- va_end(ap); emsg_core(IObuff); } ! # ifdef ABORT_ON_INTERNAL_ERROR abort(); ! # endif } + #endif /* * Give an "Internal error" message. *** ../vim-8.1.0953/src/proto/message.pro 2019-01-19 17:43:03.425449092 +0100 --- src/proto/message.pro 2019-02-19 21:29:46.765501862 +0100 *************** *** 11,19 **** void ignore_error_for_testing(char_u *error); void do_perror(char *msg); int emsg(char *s); - int semsg(const char *s, ...); void iemsg(char *s); - void siemsg(const char *s, ...); void internal_error(char *where); void emsg_invreg(int name); char *msg_trunc_attr(char *s, int force, int attr); --- 11,17 ---- *** ../vim-8.1.0953/src/proto.h 2019-02-17 17:44:36.219875473 +0100 --- src/proto.h 2019-02-19 21:32:14.388486699 +0100 *************** *** 134,139 **** --- 134,161 ---- #endif ; + /* These prototypes cannot be produced automatically. */ + int + # ifdef __BORLANDC__ + _RTLENTRYF + # endif + semsg(const char *, ...) + #ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 1, 0))) + #endif + ; + + /* These prototypes cannot be produced automatically. */ + void + # ifdef __BORLANDC__ + _RTLENTRYF + # endif + siemsg(const char *, ...) + #ifdef USE_PRINTF_FORMAT_ATTRIBUTE + __attribute__((format(printf, 1, 0))) + #endif + ; + int # ifdef __BORLANDC__ _RTLENTRYF *** ../vim-8.1.0953/src/version.c 2019-02-19 21:24:50.559543423 +0100 --- src/version.c 2019-02-19 21:33:16.472060095 +0100 *************** *** 781,782 **** --- 781,784 ---- { /* Add new patch number below this line */ + /**/ + 954, /**/ -- No engineer can take a shower without wondering if some sort of Teflon coating would make showering unnecessary. (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 ///