From: Tobias Oetiker Date: Fri, 6 Feb 2015 14:17:35 +0000 (+0100) Subject: scanf [...] is not regexp [...] X-Git-Tag: v1.5.0-rc2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f6913aee39b45ca774999997feef5ba906fe3fa;p=thirdparty%2Frrdtool-1.x.git scanf [...] is not regexp [...] --- diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 89075c49..fcf4c730 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -4678,7 +4678,7 @@ void rrd_graph_options( im->draw_y_grid = 0; break; }; - if (sscanf(optarg, "%[-0-9.e+]:%d", double_str , &im->ylabfact) == 2) { + if (sscanf(optarg, "%[0-9.e+-]:%d", double_str , &im->ylabfact) == 2) { if (rrd_strtodbl( double_str, 0, &(im->ygridstep), "option -y") != 2){ return; } @@ -4699,7 +4699,7 @@ void rrd_graph_options( break; case 1008: /* grid-dash */ if(sscanf(optarg, - "%[-0-9.e+]:%[-0-9.e+]", + "%[0-9.e+-]:%[0-9.e+-]", double_str, double_str2 ) != 2) { if ( rrd_strtodbl( double_str, 0, &(im->grid_dash_on),NULL) !=2 @@ -4718,7 +4718,7 @@ void rrd_graph_options( break; case 1002: /* right y axis */ if(sscanf(optarg, - "%[-0-9.e+]:%[-0-9.e+]", + "%[0-9.e+-]:%[0-9.e+-]", double_str, double_str2 ) == 2 && rrd_strtodbl( double_str, 0, &(im->second_axis_scale),NULL) == 2 @@ -4886,7 +4886,7 @@ void rrd_graph_options( double size = 1; int end; - if (sscanf(optarg, "%10[A-Z]:%[-0-9.e+]%n", prop, double_str, &end) >= 2 + if (sscanf(optarg, "%10[A-Z]:%[0-9.e+-]%n", prop, double_str, &end) >= 2 && rrd_strtodbl( double_str, 0, &size, NULL) == 2) { int sindex, propidx; @@ -5149,7 +5149,7 @@ int vdef_parse( int n; n = 0; - sscanf(str, "%20[-0-9.e+],%29[A-Z]%n", double_str, func, &n); + sscanf(str, "%20[0-9.e+-],%29[A-Z]%n", double_str, func, &n); if ( rrd_strtodbl( double_str, NULL, ¶m, NULL) != 2 ){ n = 0; sscanf(str, "%29[A-Z]%n", func, &n); diff --git a/src/rrd_tune.c b/src/rrd_tune.c index 21739a67..086033a6 100644 --- a/src/rrd_tune.c +++ b/src/rrd_tune.c @@ -208,7 +208,7 @@ int rrd_tune( break; case 'i': - matches = sscanf(optarg, DS_NAM_FMT ":%[-0-9.e+]", ds_nam, double_str); + matches = sscanf(optarg, DS_NAM_FMT ":%[0-9.e+-]", ds_nam, double_str); if( matches >= 1 ) { strtod_ret_val = rrd_strtodbl( double_str, NULL, &min, NULL ); } @@ -228,7 +228,7 @@ int rrd_tune( break; case 'a': - matches = sscanf(optarg, DS_NAM_FMT ":%[-0-9.e+]", ds_nam, double_str); + matches = sscanf(optarg, DS_NAM_FMT ":%[0-9.e+-]", ds_nam, double_str); if( matches >= 1 ) { strtod_ret_val = rrd_strtodbl( double_str, NULL, &max, NULL ); }