X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=501db48da41e5e3d245a35dc205335a77572b930;hb=571b5a66c6b84e743cf3b369e2c386eac5750810;hp=2f20623cb5ee0a3ed4b4f3af911d40efc3e1299b;hpb=29d7bef623fb611c8e6189cbaf321c9cb663a516;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 2f20623..501db48 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -3450,6 +3450,9 @@ int gdes_alloc( im->gdes[im->gdes_c - 1].rpnp = NULL; im->gdes[im->gdes_c - 1].p_dashes = NULL; im->gdes[im->gdes_c - 1].shift = 0.0; + im->gdes[im->gdes_c - 1].dash = 0; + im->gdes[im->gdes_c - 1].ndash = 0; + im->gdes[im->gdes_c - 1].offset = 0; im->gdes[im->gdes_c - 1].col.red = 0.0; im->gdes[im->gdes_c - 1].col.green = 0.0; im->gdes[im->gdes_c - 1].col.blue = 0.0; @@ -4066,10 +4069,10 @@ void rrd_graph_options( case 'n':{ char prop[15]; double size = 1; - char font[1024] = ""; + int end; old_locale = setlocale(LC_NUMERIC, "C"); - if (sscanf(optarg, "%10[A-Z]:%lf:%1000s", prop, &size, font) >= 2) { + if (sscanf(optarg, "%10[A-Z]:%lf%n", prop, &size, &end) >= 2) { int sindex, propidx; setlocale(LC_NUMERIC, old_locale); @@ -4079,8 +4082,17 @@ void rrd_graph_options( if (size > 0) { im->text_prop[propidx].size = size; } - if (strlen(font) > 0) { - strcpy(im->text_prop[propidx].font, font); + if (strlen(prop) > end) { + if (prop[end] == ':') { + strncpy(im->text_prop[propidx].font, + prop + end + 1, 255); + im->text_prop[propidx].font[255] = '\0'; + } else { + rrd_set_error + ("expected after font size in '%s'", + prop); + return; + } } if (propidx == sindex && sindex != 0) break;