X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_restore.c;h=75697ceee43a786ca84d0d7fdf7ace1f5bdfbfe8;hb=fbe390e15d3484315efe5802577249c8959e3556;hp=90729ebd59b93b461879d34444c8ecbd2bd21011;hpb=7f408c1ae7d1011c489fbd9123b1dd03d869e088;p=rrdtool.git diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 90729eb..75697ce 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2.15 Copyright by Tobi Oetiker, 1997-2006 + * RRDtool 1.2.21 Copyright by Tobi Oetiker, 1997-2007 ***************************************************************************** * rrd_restore.c creates new rrd from data dumped by rrd_dump.c *****************************************************************************/ @@ -64,7 +64,9 @@ int skipxml(char **buf){ } int skip(char **buf){ - char *ptr; + char *ptr; + if ((buf == NULL) || (*buf == NULL)) + return -1; ptr=(*buf); do { (*buf)=ptr; @@ -237,7 +239,7 @@ int xml2rrd(char* buf, rrd_t* rrd, char rc){ if((rrd->cdp_prep = rrd_realloc(rrd->cdp_prep, rrd->stat_head->rra_cnt *rrd->stat_head->ds_cnt*sizeof(cdp_prep_t)))==NULL){ - rrd_set_error("allocating cdp_prep"); return -1; } + rrd_set_error("allocating cdp_prep"); return -1; } memset(&(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rrd->stat_head->rra_cnt-1)]), 0, rrd->stat_head->ds_cnt*sizeof(cdp_prep_t)); @@ -254,7 +256,10 @@ int xml2rrd(char* buf, rrd_t* rrd, char rc){ read_tag(&ptr2, "xff","%lf", &(rrd->rra_def[rra_index].par[RRA_cdp_xff_val].u_val)); } else { - eat_tag(&ptr2, "params"); + if (eat_tag(&ptr2, "params") != 1) { + rrd_set_error("could not find params tag to eat and skip"); + return -1; + } skip(&ptr2); /* backwards compatibility w/ old patch */ if (strncmp(ptr2, "",7) == 0) {