From 142b07fac63966ef4e12a5ae0d1d7875905a8764 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sat, 24 Dec 2016 19:41:11 +0100 Subject: [PATCH] Fix string options with empty default When sscanf finds nothing after 'default', it does not touch the target array at all, rather than putting an empty string in it. So the target is now initialized to an empty string before the sscanf. --- UCI2WB.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index cbc11f7..6b4d19d 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -332,7 +332,7 @@ Engine2GUI() } else if(!strcmp(command, "option")) { // USI option: extract data fields char name[80], type[80], buf[1024], val[256], *q; - int min=0, max=1e9; + int min=0, max=1e9; *val = 0; if(p = strstr(line+6, " type ")) sscanf(p+1, "type %s", type), *p = '\n'; if(p = strstr(line+6, " min ")) sscanf(p+1, "min %d", &min), *p = '\n'; if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n'; -- 1.7.0.4