]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fformat): Validate number and type of arguments.
authorKarl Heuer <kwzh@gnu.org>
Fri, 25 Mar 1994 07:20:08 +0000 (07:20 +0000)
committerKarl Heuer <kwzh@gnu.org>
Fri, 25 Mar 1994 07:20:08 +0000 (07:20 +0000)
src/editfns.c

index 037c00d3c8bab16bfc90f919975bf44a14307be5..e3863c5f117197d4650d2ba0defbff51d5357210 100644 (file)
@@ -1463,7 +1463,7 @@ Use %% to put a single % into the output.")
        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 @@ Use %% to put a single % into the output.")
        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.  */