From: oetiker Date: Sun, 24 Feb 2008 14:26:16 +0000 (+0000) Subject: fix one segfault while trying to restore an invalid xml file. -- tobi X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8b01cbe023a7c412f1131013840ed078fdb6e65c;p=rrdtool.git fix one segfault while trying to restore an invalid xml file. -- tobi git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1296 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 6997cab..89743a0 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -429,7 +429,10 @@ int xml2rrd( eat_tag(&ptr2, "cdp_prep"); for (i = 0; i < (int) rrd->stat_head->ds_cnt; i++) { - eat_tag(&ptr2, "ds"); + if (eat_tag(&ptr2, "ds") != 1){ + rrd_set_error("expected to find %lu entries in ",rrd->stat_head->ds_cnt); + return -1; + } /* support to read CDP parameters */ rra_index = rrd->stat_head->rra_cnt - 1; skip(&ptr2);