From c13aa9500803ba4d9abe5c5c0289611a740f6859 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 24 Feb 2008 14:26:16 +0000 Subject: [PATCH] fix one segfault while trying to restore an invalid xml file. -- tobi git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1296 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_restore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/program/src/rrd_restore.c b/program/src/rrd_restore.c index 6997cab9..89743a03 100644 --- a/program/src/rrd_restore.c +++ b/program/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); -- 2.30.2