From aa5c375ca9d79478f76866efff634b9dd65ba32e Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 2 May 2009 11:14:45 +0100 Subject: [PATCH] Fix a very old UCI option parsing bug We currently fail on an option with a sapece in the name, as example setoption name Clear Hash returns error message "Option Clear not found". This patch fixes this off-by-one type bug. Thanks to Joona for spotting this. Signed-off-by: Marco Costalba --- src/uci.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index 48459757..c9120ddb 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -251,11 +251,13 @@ namespace { if (token == "name") { uip >> name; - uip >> token; - while (!uip.eof() && token != "value") + while (!uip.eof()) { - name += (" " + token); - uip >> token; + uip >> token; + if (token == "value") + break; + + name += (" " + token); } if (token == "value") { -- 2.39.2