summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7c8fb05)
raw | patch | inline | side by side (parent: 7c8fb05)
author | Peter Holik <holik@it-technology.at> | |
Thu, 19 Feb 2009 12:00:59 +0000 (13:00 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Thu, 19 Feb 2009 12:00:59 +0000 (13:00 +0100) |
Hi,
One of my ipmi sensors has a name longer than DATA_MAX_NAME_LEN and this
results in a SEGV.
cu Peter
One of my ipmi sensors has a name longer than DATA_MAX_NAME_LEN and this
results in a SEGV.
cu Peter
src/ipmi.c | patch | blob | history |
diff --git a/src/ipmi.c b/src/ipmi.c
index f3ba95a885a152d73ecc3d9c9162e87410c1e2fc..f026c171680d25f285701e2f11ab5c256bb9d446 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
ipmi_sensor_get_name (sensor, sensor_name, sizeof (sensor_name));
sensor_name[sizeof (sensor_name) - 1] = 0;
- len = DATA_MAX_NAME_LEN - strlen(sensor_name);
+ len = DATA_MAX_NAME_LEN - strlen(sensor_name) - 1;
strncat(sensor_name, " ", len--);
strncat(sensor_name, ipmi_entity_get_entity_id_string(ent), len);
char *sensor_name_ptr_id = strstr (sensor_name, "(");
sensor_name_ptr += 2;
- len = DATA_MAX_NAME_LEN - strlen(sensor_name);
+ len = DATA_MAX_NAME_LEN - strlen(sensor_name) - 1;
strncat(sensor_name, " ", len--);
strncat(sensor_name, sensor_name_ptr_id,
MIN(sensor_name_ptr - sensor_name_ptr_id - 1, len));