[rrd-developers] RRD DERIVE Data type, invalid inputs.

Greg Prosser gregp-rrd-developers at arrogant.org
Thu Nov 25 15:52:56 MET 2004

Hi Guys,
I'm not sure what combination of environments contributed to this, but
I've discovered what I believe is a bug in the handling of rrdtool's
DERIVE data source, specifically in the handling of invalid data checking
during updates.

You currently check that every character of the string is within the range
'0' - '9', which is fine, but the code does not properly handle having a
'-' or '+' in front of the number -- the if condition is set-up

Currently, at around line 361 of rrd_update.c, you have the following:

                case DST_DERIVE:
                    if(rrd.pdp_prep[i].last_ds[0] != 'U'){
                       for(ii=0;updvals[i+1][ii] != '\0';ii++){
                            if(updvals[i+1][ii] < '0' || updvals[i+1][ii] > '9' || (ii==0 && updvals[i+1][ii] == '-')){
                                 rrd_set_error("not a simple integer: '%s'",updvals[i+1]);

(which I'm more than certain will wrap horribly)

Specifically, my SNMP library gives me back values in the form '+xxxxxx'
sometimes, and this check throws out those values.  I also believe this
code throws out '-xxxxxx' in DERIVE's as well, which probably breaks
something somewhere.

I've attached a patch to change this to handle both leading + and leading
- correctly (not throw them out) and still enforce this check.

It applies to the newest version of RRDtool fine, and I've been using it
for a long while without issue (of course, it's not as if I put invalid
data in my RRD's a lot).



-- Attached file removed by Ecartis and put at URL below --
-- Desc: +/- RRDtool handling
-- Size: 676 bytes
-- URL : http://www.ee.ethz.ch/~slist/p/rrdtool-derive-plusminus.diff

Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-developers mailing list