From: Tobias Oetiker Date: Mon, 17 Nov 2014 22:48:12 +0000 (+0100) Subject: complain about strings that are too long when restoring to rrd X-Git-Tag: v1.5.0-rc1~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F556%2Fhead;p=thirdparty%2Frrdtool-1.x.git complain about strings that are too long when restoring to rrd --- diff --git a/src/rrd_restore.c b/src/rrd_restore.c index df1f0725..190bc21e 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -239,11 +239,15 @@ static xmlChar* get_xml_text ( static int get_xml_string( xmlTextReaderPtr reader, char *value, - int max_len) + unsigned int max_len) { xmlChar *str; str = get_xml_text(reader); if (str != NULL){ + if (strlen((char *)str) >= max_len){ + rrd_set_error("'%s' is longer than %i",str,max_len); + return -1; + } strncpy(value,(char *)str,max_len); xmlFree(str); return 0;