freeipmi/freeipmi-max-sensor.patch

37 lines
1.3 KiB
Diff

2013-12-19 Dave Love <fx@gnu.org>
* ipmi-sensors/ipmi-sensors.c (_calculate_record_ids): Check
record numbr against array length.
* common/toolcommon/tool-sensor-common.h (MAX_SENSOR_RECORD_IDS):
Increase to 1024.
--- freeipmi-1.3.4/common/toolcommon/tool-sensor-common.h.orig 2013-04-26 18:01:55.000000000 +0100
+++ freeipmi-1.3.4/common/toolcommon/tool-sensor-common.h 2013-12-19 11:38:38.061632119 +0000
@@ -55,7 +55,7 @@
#define MAX_SENSOR_TYPES 256
#else /* !0 */
/* achu: pick more reasonable limits than the theoretical maxes */
-#define MAX_SENSOR_RECORD_IDS 512
+#define MAX_SENSOR_RECORD_IDS 1024
#define MAX_SENSOR_TYPES 64
#endif /* !0 */
#endif /* !__CYGWIN__ */
--- freeipmi-1.3.4/ipmi-sensors/ipmi-sensors.c.orig 2013-05-08 18:09:34.000000000 +0100
+++ freeipmi-1.3.4/ipmi-sensors/ipmi-sensors.c 2013-12-19 11:38:54.132859006 +0000
@@ -514,6 +514,13 @@
}
output_record_ids[(*output_record_ids_length)] = record_id;
+ if (output_record_ids_length >= MAX_SENSOR_RECORD_IDS)
+ {
+ fprintf (stderr,
+ "Too many sensors; limit is %d\n",
+ MAX_SENSOR_RECORD_IDS - 1);
+ return (-1);
+ }
(*output_record_ids_length)++;
}
}