# HG changeset patch # User Karl Heuer # Date 763857840 0 # Node ID 5e8a442a836de9a9219d16991e965dc6269a990d # Parent 62db5566c287dcf9553a38f87cb0883aa552738f (read_minibuf): Disallow trailing junk. diff -r 62db5566c287 -r 5e8a442a836d src/minibuf.c --- a/src/minibuf.c Wed Mar 16 22:14:23 1994 +0000 +++ b/src/minibuf.c Wed Mar 16 22:44:00 1994 +0000 @@ -293,7 +293,17 @@ /* If Lisp form desired instead of string, parse it. */ if (expflag) - val = Fread (val); + { + Lisp_Object expr_and_pos; + unsigned char *p; + + expr_and_pos = Fread_from_string (val, Qnil, Qnil); + /* Ignore trailing whitespace; any other trailing junk is an error. */ + for (p = XSTRING (val)->data + XINT (Fcdr (expr_and_pos)); *p; p++) + if (*p != ' ' && *p != '\t' && *p != '\n') + error ("Trailing garbage following expression"); + val = Fcar (expr_and_pos); + } unbind_to (count, Qnil); /* The appropriate frame will get selected in set-window-configuration. */