diff options
| author | Karl Heuer | 1994-03-16 22:44:00 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-03-16 22:44:00 +0000 |
| commit | 8acd16de1e1835630a3ef996ab75ea63391e9846 (patch) | |
| tree | e5b4cc287794946076432c2cb11cf272688070dd /src | |
| parent | 3ace87e34c93a6b000932510d3bd3b81d4056d20 (diff) | |
| download | emacs-8acd16de1e1835630a3ef996ab75ea63391e9846.tar.gz emacs-8acd16de1e1835630a3ef996ab75ea63391e9846.zip | |
(read_minibuf): Disallow trailing junk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 384c85f4c55..c3209e6f933 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -293,7 +293,17 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos) | |||
| 293 | 293 | ||
| 294 | /* If Lisp form desired instead of string, parse it. */ | 294 | /* If Lisp form desired instead of string, parse it. */ |
| 295 | if (expflag) | 295 | if (expflag) |
| 296 | val = Fread (val); | 296 | { |
| 297 | Lisp_Object expr_and_pos; | ||
| 298 | unsigned char *p; | ||
| 299 | |||
| 300 | expr_and_pos = Fread_from_string (val, Qnil, Qnil); | ||
| 301 | /* Ignore trailing whitespace; any other trailing junk is an error. */ | ||
| 302 | for (p = XSTRING (val)->data + XINT (Fcdr (expr_and_pos)); *p; p++) | ||
| 303 | if (*p != ' ' && *p != '\t' && *p != '\n') | ||
| 304 | error ("Trailing garbage following expression"); | ||
| 305 | val = Fcar (expr_and_pos); | ||
| 306 | } | ||
| 297 | 307 | ||
| 298 | unbind_to (count, Qnil); /* The appropriate frame will get selected | 308 | unbind_to (count, Qnil); /* The appropriate frame will get selected |
| 299 | in set-window-configuration. */ | 309 | in set-window-configuration. */ |