diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 17:34:01 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 17:34:01 +0200 |
| commit | 346108ec62700cefc292768d455589b5366e8997 (patch) | |
| tree | d43e6d065aaa5c92e151b184f239a2bd8b071c45 /src/command_manager.cc | |
| parent | 99eaa259e6f4bd0e9fa81c1db3b802b7e5f7a306 (diff) | |
CommandManager::parse: fix invalid memory read
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index beeb6066..4e982663 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -147,14 +147,15 @@ TokenList parse(const String& line, } else { - while ((line[pos] != opening_delimiter or line[pos-1] == '\\') and - pos != length) + while (pos != length and + (line[pos] != opening_delimiter or line[pos-1] == '\\')) ++pos; } } else while (pos != length and not is_horizontal_blank(line[pos]) and - (not is_command_separator(line[pos]) or line[pos-1] == '\\')) + (not is_command_separator(line[pos]) or + (pos != 0 and line[pos-1] == '\\'))) ++pos; if (token_start != pos) |
