]> granicus.if.org Git - vim/commitdiff
patch 8.1.0954: arguments of semsg() and siemsg() are not checked v8.1.0954
authorBram Moolenaar <Bram@vim.org>
Tue, 19 Feb 2019 20:34:05 +0000 (21:34 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 19 Feb 2019 20:34:05 +0000 (21:34 +0100)
Problem:    Arguments of semsg() and siemsg() are not checked.
Solution:   Add function prototype with __attribute__.

src/message.c
src/proto.h
src/proto/message.pro
src/version.c

index 621edb9701a93f9aecc13dfb19cc5ec966d300c7..a7aca2b99c2a0bffae53c5c5d988985468fe594f 100644 (file)
@@ -730,6 +730,7 @@ emsg(char *s)
     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,6 +750,7 @@ semsg(const char *s, ...)
     }
     return TRUE;               /* no error messages at the moment */
 }
+#endif
 
 /*
  * Same as emsg(...), but abort on error when ABORT_ON_INTERNAL_ERROR is
@@ -765,6 +767,7 @@ iemsg(char *s)
 #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,10 +786,11 @@ siemsg(const char *s, ...)
        va_end(ap);
        emsg_core(IObuff);
     }
-#ifdef ABORT_ON_INTERNAL_ERROR
+# ifdef ABORT_ON_INTERNAL_ERROR
     abort();
-#endif
+# endif
 }
+#endif
 
 /*
  * Give an "Internal error" message.
index 43192ffd52b059a7842ea37e9311d23377c957c4..4a5977f606228d89646c86c881cd2168e9bd75e9 100644 (file)
@@ -134,6 +134,28 @@ smsg_attr_keep(int, const char *, ...)
 #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
index 792ac5ddfcadd218b7c9729824d5a08bcb23752c..806de872bc60f6d8a9672705d942229bb53e532c 100644 (file)
@@ -11,9 +11,7 @@ int emsg_not_now(void);
 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);
index a266ce08f4a62e1c7fcb59c7c62a9aceb0e8c519..6fe4c9e35df0fdcdac4d1333407d4fb420ac15b3 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    954,
 /**/
     953,
 /**/