security fix: replaced strcpy with safeStrCpy from backend.c
[xboard.git] / xoptions.c
index e60e845..630903a 100644 (file)
@@ -1233,7 +1233,7 @@ void UciCallback(w, client_data, call_data)
            // Some changed setting need immediate sending always.
            PonderNextMoveEvent(ponder);
            if(oldCores != appData.smpCores)
-               NewSettingEvent(False, "cores", appData.smpCores);
+               NewSettingEvent(False, &(first.maxCores), "cores", appData.smpCores);
       }
       UciPopDown();
       return;
@@ -1443,9 +1443,9 @@ void SettingsCallback(w, client_data, call_data)
                    XtSetArg(args[0], XtNstring, &val);
                    XtGetValues(currentCps->option[i].handle, args, 1);
                    if(strcmp(currentCps->option[i].textValue, val)) {
-                       strcpy(currentCps->option[i].textValue, val);
-                       sprintf(buf, "option %s=%s\n", currentCps->option[i].name, val);
-                       SendToProgram(buf, currentCps);
+                     safeStrCpy(currentCps->option[i].textValue, val, sizeof(currentCps->option[i].textValue)/sizeof(currentCps->option[i].textValue[0]));
+                     sprintf(buf, "option %s=%s\n", currentCps->option[i].name, val);
+                     SendToProgram(buf, currentCps);
                    }
                    break;
                case Spin: