News for hackers. Stuff that matters.
Re:Is Lisp still useful in today's world? (2011) by sdkmvx on Thursday February 21, 2013 @06:50PM (#5261479)
Is it actually dangerous to use read for user input?

    (defun read-data ()
      (let ((data (let ((*read-eval* 'nil)) (read))))
        (mapcar
         (lambda (x) (format 't "~a: ~a~%" (car x) (cdr x)))
         data)))
Then I can

    (read-data)
    (("a" . 1) ("b" . 2) ("c" . (funcall (lambda () (princ "I ran code!")))))
And the following will print.

    a: 1
    b: 2
    c: (FUNCALL (LAMBDA () (PRINC I ran code!)))
But of course unless I eval the code, arbitrary code will not run (assuming I haven't forgotten some aspect of the reader).

There are no comments on this comment yet.