X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=uci.c;h=1f39f6a84112cf9ce003915fe8a7fe54daea0d44;hb=4b4ee0f5a685c7cca0c5f5b791f05ee157b4a219;hp=5eeda2b5ebc83639d60a0fa1cbbf052b45abaa76;hpb=952edaa8941552b9d0faef8d06161f44c2cc83fd;p=xboard.git diff --git a/uci.c b/uci.c index 5eeda2b..1f39f6a 100644 --- a/uci.c +++ b/uci.c @@ -26,10 +26,6 @@ #include #include -#if HAVE_MALLOC_H - #include -#endif - #include "common.h" #include "backend.h" Boolean GetArgValue(char *a); @@ -40,6 +36,7 @@ void InitEngineUCI( const char * iniDir, ChessProgramState * cps ) char *p, *q; char polyglotCommand[MSG_SIZ]; + if(cps->isUCI == 2) p = appData.ucciAdapter; else p = appData.adapterCommand; q = polyglotCommand; while(*p) { @@ -55,8 +52,8 @@ void InitEngineUCI( const char * iniDir, ChessProgramState * cps ) if(cps == &second) { // change options for first into those for second engine if(strstr(buf, "first") == buf) sprintf(argName, "second%s", buf+5); else if(buf[0] == 'f') sprintf(argName, "s%s", buf+1); else - strcpy(argName, buf); - } else strcpy(argName, buf); + safeStrCpy(argName, buf, sizeof(argName)/sizeof(argName[0])); + } else safeStrCpy(argName, buf, sizeof(argName)/sizeof(argName[0])); if(GetArgValue(argName)) { // look up value of option with this name s = argName; while(*s) *q++ = *s++;