version 1.4.36b
[polyglot.git] / uci.c
diff --git a/uci.c b/uci.c
index f8537e2..e44fa34 100644 (file)
--- a/uci.c
+++ b/uci.c
@@ -162,8 +162,8 @@ void uci_clear(uci_t * uci) {
    uci->best_depth = 0;\r
    uci->best_sel_depth = 0;\r
    line_clear(uci->best_pv);\r
-\r
-   uci->node_nb = 0;\r
+// make the default 1 instead of 0 so that info lines can be recognized by their node number 0\r
+   uci->node_nb = 1;\r
    uci->time = 0.0;\r
    uci->speed = 0.0;\r
    uci->cpu = 0.0;\r
@@ -666,7 +666,8 @@ static int parse_info(uci_t * uci, const char string[]) {
           }else if(my_string_case_equal(argument,"Resign")){\r
                          event |= EVENT_RESIGN;\r
           }else{\r
-              strcpy(uci->info,argument);\r
+              snprintf(uci->info,sizeof(uci->info),"%s",argument);\r
+              uci->info[sizeof(uci->info)-1]='\0';\r
               event|=EVENT_INFO;\r
           }\r
          // TODO: argument to EOS\r
@@ -692,11 +693,10 @@ static int parse_info(uci_t * uci, const char string[]) {
       } else {\r
 \r
          my_log("POLYGLOT unknown option \"%s\" for command \"%s\"\n",option,command);\r
-             // this is for buggy engines; it should probably be protected\r
+             // This should probably be protected\r
              // by a "WorkAround" option.\r
-         strcpy(uci->info,option);\r
-         strcat(uci->info," ");\r
-         strcat(uci->info,argument);\r
+         snprintf(uci->info,sizeof(uci->info),"%s %s",option,argument);\r
+         uci->info[sizeof(uci->info)-1]='\0';\r
          event|=EVENT_INFO;\r
       }\r
    }\r