Fix off-by-one in readlink() buffer size handling
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Thu, 13 Oct 2011 09:21:07 +0000 (11:21 +0200)
committerNeilBrown <neilb@suse.de>
Mon, 17 Oct 2011 00:15:04 +0000 (11:15 +1100)
commit9cf014ec4055d95f32e028f1a004ea165d90ffe4
tree2597622f1c17b2f2aeee3653459a9abc1768013f
parentb601104eb4a4733a838fb86e9e279fed14ce9d3f
Fix off-by-one in readlink() buffer size handling

readlink() returns the number of bytes in the buffer.

If we do something like

len = readlink(path, buf, sizeof(buf));
buf[len] = '\0';

we might write one byte past the end of the buffer.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: NeilBrown <neilb@suse.de>
policy.c
super-intel.c
sysfs.c
util.c