From: Mathnerd314 Date: Sun, 3 May 2009 22:06:13 +0000 (+0000) Subject: Fix infinite loop when encountering \r in a string X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d280c800be43b01c92ce31dca9d0a290220e63dd;p=supertux.git Fix infinite loop when encountering \r in a string SVN-Revision: 5886 --- diff --git a/src/lisp/lexer.cpp b/src/lisp/lexer.cpp index 451cb9aff..18f28e28a 100644 --- a/src/lisp/lexer.cpp +++ b/src/lisp/lexer.cpp @@ -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;