From a0d848da8d70933f39119415647552c88e3beaf4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 7 Jun 2017 13:09:45 +0100 Subject: [PATCH] Do not allow whitespaces as % string delimiters --- src/command_manager.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/command_manager.cc b/src/command_manager.cc index fa7a5044..fc615078 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -210,11 +210,13 @@ Token parse_percent_token(Reader& reader) ++reader; StringView type_name = reader.substr_from(type_start); - if (throw_on_unterminated and not reader) - throw parse_error{format("expected a string delimiter after '%{}'", - type_name)}; - else if (not reader) + if (not reader or is_blank(*reader)) + { + if (throw_on_unterminated) + throw parse_error{format("expected a string delimiter after '%{}'", + type_name)}; return {}; + } Token::Type type = token_type(type_name);