From 8b01cbe023a7c412f1131013840ed078fdb6e65c 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/program@1296 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_restore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- 2.30.2