[rrd-users] Core Dump / Seg Fault (+patch)

Oliver Cook ollie at uk.clara.net
Fri Apr 6 19:08:55 MEST 2001


rrdtool 1.0.33 can be made to seg fault in the
following way:

mutare# gdb rrdtool
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...
(gdb) r update poseidon-traffic-1.rrd N::
Starting program: /usr/home/ollie/rrdtest/rrdtool update poseidon-traffic-1.rrd N::

Program received signal SIGSEGV, Segmentation fault.
0x805d8a6 in rrd_diff (a=0x8097000 <Error reading address 0x8097000: Bad address>, b=0x8093100 "") at rrd_diff.c:33
33              a++;
(gdb)

This is due to a bug in rrd_diff, which the following
patch fixes. The bug is that "!" takes a higher preference
than "||".

--- rrd_diff.c.orig     Fri Apr  6 17:57:53 2001
+++ rrd_diff.c  Fri Apr  6 18:05:29 2001
@@ -29,13 +29,13 @@
     char res[LAST_DS_LEN+1], *a1, *b1, *r1, *fix;
     int c,x,m;

-    while (!isdigit((int)*a) || *a==0)
+    while (!(isdigit((int)*a) || *a==0))
         a++;
     fix=a;
     while (isdigit((int)*fix))
        fix++;
     *fix = 0; /* maybe there is some non digit data in the string */
-    while (!isdigit((int)*b) || *b==0)
+    while (!(isdigit((int)*b) || *b==0))
         b++;
     fix=b;
     while (isdigit((int)*fix))

Yours,

Ollie

-- 
Oliver Cook    Systems Administrator, ClaraNET
ollie at uk.clara.net      020 7903 3000 ext. 291

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



More information about the rrd-users mailing list