Skip to contentSkip to conversation

segfault in sensord (lm_sensors2 2.8.5)

DISCUSSION Tim Toohey 2 participants 3 messages May 19, 2005

lore
Share & tools
lore

Tim Toohey

author
#0 lore raw

Hi,

In prog/sensord/rrd.c (since revision 1.5 I think) there's a null pointer dereference when used with the --load-average option. This seems to only be a problem when initialing creating the rrd log file (though I'm not sure).

Below is my fix.

Thanks,
Tim Toohey

cvs diff: Diffing .
Index: rrd.c
=================================RCS file: /home/cvs/lm_sensors2/prog/sensord/rrd.c,v retrieving revision 1.7
diff -r1.7 rrd.c
198c198
< switch (feature->type) { /* arbitrary sanity limits */
---

Quoted 1 line
    switch (feature!=NULL ? feature->type : 0) { /* arbitrary sanity limits 

*/

#1 lore raw
Quoted 6 lines

In prog/sensord/rrd.c (since revision 1.5 I think) there's a null pointer dereference when used with the --load-average option. This seems to only be a problem when initialing creating the rrd log file (though I'm not sure).

Below is my fix.

I've applied a slightly different one (inlined below). Yours would arbitrarily apply voltage-like sanity limits to the feature.

Please confirm that it works OK for you.

Thanks for reporting.

prog/sensord/rrd.c renamed from prog/sensord/rrd.c.orig +1 -1
@@ -195,7 +195,7 @@
     char *ptr = rrdBuff + data->num * RRD_BUFF;
     const char *min, *max;
     data->argv[data->num ++] = ptr;
-    switch (feature->type) { /* arbitrary sanity limits */
+    switch (feature ? feature->type : DataType_other) { /* arbitrary sanity limits */
       case DataType_voltage:
         min="-25";
         max="25";
Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
author
#2 lore raw
In reply to Tim Toohey
Quoted 11 lines · you
Quoted 6 lines

In prog/sensord/rrd.c (since revision 1.5 I think) there's a null pointer dereference when used with the --load-average option. This seems to only be a problem when initialing creating the rrd log file (though I'm not sure).

Below is my fix.

I've applied a slightly different one (inlined below). Yours would arbitrarily apply voltage-like sanity limits to the feature.

Please confirm that it works OK for you.

I can confirm that it runs OK.
That is, it doesn't segfault. I'm not looking at sanity limits (I'm not sure when they would appear in my setup) - my temperature charts look sensible.

Quoted 2 lines

Thanks for reporting.

Thanks for letting me :-)