[collectd] PATCH ipmi off by one error
octo at verplant.org
Thu Feb 19 13:08:53 CET 2009
On Thu, Feb 19, 2009 at 12:16:40PM +0100, Peter Holik wrote:
> One of my ipmi sensors has a name longer than DATA_MAX_NAME_LEN and
> this results in a SEGV.
thanks for the patch, I've applied it to the collectd-4.5 branch so it
goes into the next patch releases.
I have to admit I'm a bit surprised that you patch is supposed to fix
If the sensor's name is longer than the buffer, then after this line
len = DATA_MAX_NAME_LEN - strlen(sensor_name) - 1;
len should be 0 (zero), because `strlen(sensor_name)' will be
`DATA_MAX_NAME_LEN - 1'. After this line
strncat(sensor_name, " ", len--);
len should therefore be `-1'. When this line is executed
strncat(sensor_name, ipmi_entity_get_entity_id_string(ent), len);
len (an integer) is casted to `size_t', usually an unsigned integer
I'll probably see if I can come up with another work-around that doesn't
rely on `size_t' being signed..
Florian octo Forster
Hacker in training
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090219/353963c1/attachment.pgp
More information about the collectd