]> git.sesse.net Git - stockfish/commitdiff
Fix a very old UCI option parsing bug
authorMarco Costalba <mcostalba@gmail.com>
Sat, 2 May 2009 10:14:45 +0000 (11:14 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 2 May 2009 10:52:49 +0000 (11:52 +0100)
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 <mcostalba@gmail.com>
src/uci.cpp

index 48459757dda217aaf117fc5fbc60211722555488..c9120ddbd7728c1b7dfc72cf6b6930118dc2f594 100644 (file)
@@ -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")
         {