Fix infinite loop when encountering \r in a string
authorMathnerd314 <man.is.allan@gmail.com>
Sun, 3 May 2009 22:06:13 +0000 (22:06 +0000)
committerMathnerd314 <man.is.allan@gmail.com>
Sun, 3 May 2009 22:06:13 +0000 (22:06 +0000)
SVN-Revision: 5886

src/lisp/lexer.cpp

index 451cb9a..18f28e2 100644 (file)
@@ -102,8 +102,8 @@ Lexer::getNextToken()
       return TOKEN_CLOSE_PAREN;
     case '"': {  // string
       int startline = linenumber;
-      nextChar();
       while(1) {
+        nextChar();
         switch(c) {
         case '"':
           nextChar();
@@ -132,7 +132,8 @@ Lexer::getNextToken()
         default:
           break;
         }
-        addChar();
+        if(token_length < MAX_TOKEN_LENGTH)
+          token_string[token_length++] = c;
       }
 string_finished:
       token_string[token_length] = 0;