]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-06-15 Vladimir Serbinenko <phcoder@gmail.com>
authorphcoder <phcoder@localhost>
Mon, 15 Jun 2009 21:04:17 +0000 (21:04 +0000)
committerphcoder <phcoder@localhost>
Mon, 15 Jun 2009 21:04:17 +0000 (21:04 +0000)
Fix handling of string like \"hello\" and "a
b"

* script/sh/lexer.c
(grub_script_yylex): fix parsing of quoting, escaping and newline

script/sh/lexer.c

index f21430fe1db92662003070f01207fa45156d868a..d3577d44cb84e8af0211ba4d6c05e0e7b068bb92 100644 (file)
@@ -156,18 +156,20 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
       return token;
     }
 
-  for (;! state->done && (*state->script || firstrun); firstrun = 0)
+  for (;! state->done; firstrun = 0)
     {
 
       if (! *state->script)
        {
          /* Check if more tokens are requested by the parser.  */
          if (((state->refs && ! parsestate->err)
-              || state->state == GRUB_PARSER_STATE_ESC)
+              || state->state == GRUB_PARSER_STATE_ESC
+              || state->state == GRUB_PARSER_STATE_QUOTE
+              || state->state == GRUB_PARSER_STATE_DQUOTE)
              && state->getline)
            {
              int doexit = 0;
-             while (!state->script || ! grub_strlen (state->script))
+             while (!state->script || ! *state->script)
                {
                  grub_free (state->newscript);
                  state->newscript = 0;