diff options
| author | Karl Heuer | 1994-03-25 07:20:08 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-03-25 07:20:08 +0000 |
| commit | b22e7ecc3f041dfe12c6bda14a8b2b5f7e8173c3 (patch) | |
| tree | 436b18c5729f4dfbef53e7eca6e6ee5f17d29e41 /src | |
| parent | ba32f2db71110396e28e6c1841dfdd2aa5daa68c (diff) | |
| download | emacs-b22e7ecc3f041dfe12c6bda14a8b2b5f7e8173c3.tar.gz emacs-b22e7ecc3f041dfe12c6bda14a8b2b5f7e8173c3.zip | |
(Fformat): Validate number and type of arguments.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c index 037c00d3c8b..e3863c5f117 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1463,7 +1463,7 @@ Use %% to put a single % into the output.") | |||
| 1463 | if (*format == '%') | 1463 | if (*format == '%') |
| 1464 | format++; | 1464 | format++; |
| 1465 | else if (++n >= nargs) | 1465 | else if (++n >= nargs) |
| 1466 | ; | 1466 | error ("format string wants too many arguments"); |
| 1467 | else if (*format == 'S') | 1467 | else if (*format == 'S') |
| 1468 | { | 1468 | { |
| 1469 | /* For `S', prin1 the argument and then treat like a string. */ | 1469 | /* For `S', prin1 the argument and then treat like a string. */ |
| @@ -1480,6 +1480,8 @@ Use %% to put a single % into the output.") | |||
| 1480 | else if (XTYPE (args[n]) == Lisp_String) | 1480 | else if (XTYPE (args[n]) == Lisp_String) |
| 1481 | { | 1481 | { |
| 1482 | string: | 1482 | string: |
| 1483 | if (*format != 's' && *format != 'S') | ||
| 1484 | error ("format specifier doesn't match argument type"); | ||
| 1483 | total += XSTRING (args[n])->size; | 1485 | total += XSTRING (args[n])->size; |
| 1484 | } | 1486 | } |
| 1485 | /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ | 1487 | /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ |