changeset 6528:d0f6a386b7cb

(Fformat): Validate number and type of arguments.
author Karl Heuer <kwzh@gnu.org>
date Fri, 25 Mar 1994 07:20:08 +0000
parents ab9f20a3f502
children 79c305d1edcb
files src/editfns.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Fri Mar 25 06:12:40 1994 +0000
+++ b/src/editfns.c	Fri Mar 25 07:20:08 1994 +0000
@@ -1463,7 +1463,7 @@
 	if (*format == '%')
 	  format++;
 	else if (++n >= nargs)
-	  ;
+	  error ("format string wants too many arguments");
 	else if (*format == 'S')
 	  {
 	    /* For `S', prin1 the argument and then treat like a string.  */
@@ -1480,6 +1480,8 @@
 	else if (XTYPE (args[n]) == Lisp_String)
 	  {
 	  string:
+	    if (*format != 's' && *format != 'S')
+	      error ("format specifier doesn't match argument type");
 	    total += XSTRING (args[n])->size;
 	  }
 	/* Would get MPV otherwise, since Lisp_Int's `point' to low memory.  */