diff options
author | Bill Nottingham <notting@redhat.com> | 2009-05-27 13:48:32 -0400 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2009-05-27 13:48:32 -0400 |
commit | 9ea8d375fe3848151ddf1b9c41cb0e70871caeea (patch) | |
tree | fc948e7d3d983d25ef048db85a87a732369f5df9 /isys | |
parent | 776a87aa63f959f1b43425048ea316db95347a3d (diff) | |
download | anaconda-9ea8d375fe3848151ddf1b9c41cb0e70871caeea.tar.gz anaconda-9ea8d375fe3848151ddf1b9c41cb0e70871caeea.tar.xz anaconda-9ea8d375fe3848151ddf1b9c41cb0e70871caeea.zip |
Fix off-by-one errors in read.
Only read in 63 bytes, to make sure we preserve any trailing NULs for
end of string.
Diffstat (limited to 'isys')
-rw-r--r-- | isys/devices.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/isys/devices.c b/isys/devices.c index 1efff622b..98c876929 100644 --- a/isys/devices.c +++ b/isys/devices.c @@ -68,7 +68,7 @@ struct device **getDevices(enum deviceType type) { fd = open(path, O_RDONLY); if (fd == -1) continue; - if (read(fd, buf, 64) <= 0) { + if (read(fd, buf, 63) <= 0) { close(fd); continue; } @@ -97,7 +97,7 @@ struct device **getDevices(enum deviceType type) { if (fd == -1) continue; - if (read(fd, buf, 64) <= 0) { + if (read(fd, buf, 63) <= 0) { close(fd); continue; } @@ -155,7 +155,7 @@ storagedone: fd = open(path, O_RDONLY); if (fd == -1) continue; - if (read(fd, buf, 64) <= 0) { + if (read(fd, buf, 63) <= 0) { close(fd); continue; } @@ -179,7 +179,7 @@ storagedone: fd = open(path, O_RDONLY); if (fd != -1) { memset(buf, '\0', 64); - if (read(fd, buf, 64) > 0) { + if (read(fd, buf, 63) > 0) { int i; for (i = (strlen(buf)-1); isspace(buf[i]); i--) buf[i] = '\0'; |