From: H.G. Muller Date: Sun, 2 Sep 2012 16:30:46 +0000 (+0200) Subject: Fix crash of ICS caused by printing invalid seek ad X-Git-Url: http://winboard.nl/cgi-bin?p=capablanca.git;a=commitdiff_plain;h=775ebd08d138ed1079cf8c6113e680632f304e4f Fix crash of ICS caused by printing invalid seek ad A seek ad with invalid arguments obtained status SEEK_CLOSED before processing it was aborted, with as result an uninitialized ad, which would crash a later sought command. --- diff --git a/lasker-2.2.3/src/seekproc.c b/lasker-2.2.3/src/seekproc.c index 8a1b9f6..e072fd3 100644 --- a/lasker-2.2.3/src/seekproc.c +++ b/lasker-2.2.3/src/seekproc.c @@ -65,7 +65,6 @@ int com_seek(int p, param_list param) pprintf(p, "ERROR: Sorry, all available slots for seek are closed.\n"); return COM_OK; } - seek_globals.ads[num].status = SEEKCLOSED; seek_globals.ads[num].whofrom = p; #if 1 @@ -78,6 +77,9 @@ int com_seek(int p, param_list param) board,param[0].val.string)) return COM_OK; /* couldn't parse */ } + + seek_globals.ads[num].status = SEEKCLOSED; // params are valid; create ad + if(wt < 0) wt = pp->d_time; if(bt < 0) bt = wt; if(winc < 0) winc = pp->d_inc; if(binc < 0) binc = bt; seek_globals.ads[num].wtime = wt; @@ -100,6 +102,8 @@ int com_seek(int p, param_list param) seek_globals.ads[num].seek_color = random() % 2; #else + seek_globals.ads[num].status = SEEKCLOSED; + if (param[0].type == TYPE_INT) seek_globals.ads[num].wtime = param[0].val.integer; /* White time */ else