changeset 6384:5e8a442a836d

(read_minibuf): Disallow trailing junk.
author Karl Heuer <kwzh@gnu.org>
date Wed, 16 Mar 1994 22:44:00 +0000
parents 62db5566c287
children e81e7c424e8a
files src/minibuf.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.  */