]> git.eshelyaron.com Git - emacs.git/commitdiff
(read_minibuf): Disallow trailing junk.
authorKarl Heuer <kwzh@gnu.org>
Wed, 16 Mar 1994 22:44:00 +0000 (22:44 +0000)
committerKarl Heuer <kwzh@gnu.org>
Wed, 16 Mar 1994 22:44:00 +0000 (22:44 +0000)
src/minibuf.c

index 384c85f4c55449f25240bdf28dd7c738ad0944e8..c3209e6f93361dceda7e73549b74eea901da487e 100644 (file)
@@ -293,7 +293,17 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
 
   /* 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.  */