summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2001-02-28 06:39:27 +0000
committerMatt Wilson <msw@redhat.com>2001-02-28 06:39:27 +0000
commit546e833acbae52530446028c2f0e8f79bd438cce (patch)
tree2dd370150334aeda595ce5f83b502176de349726 /isys
parentf7ebcff60d81bfd1b2817f27c9ff901b4d0e64fc (diff)
downloadanaconda-546e833acbae52530446028c2f0e8f79bd438cce.tar.gz
anaconda-546e833acbae52530446028c2f0e8f79bd438cce.tar.xz
anaconda-546e833acbae52530446028c2f0e8f79bd438cce.zip
be paranoid about walking off the end
Diffstat (limited to 'isys')
-rw-r--r--isys/probe.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/isys/probe.c b/isys/probe.c
index 69e334665..3991e239b 100644
--- a/isys/probe.c
+++ b/isys/probe.c
@@ -523,7 +523,7 @@ static int I2OGetDevices(struct knownDevices * devices) {
struct kddevice newDevice;
int fd, i;
char *buf;
- char * start, *chptr, *next;
+ char * start, *chptr, *next, *end;
char ctl[40];
/* Read from /proc/partitions */
@@ -552,7 +552,8 @@ static int I2OGetDevices(struct knownDevices * devices) {
if (!start) goto bye;
start++;
- while (*start) {
+ end = start + strlen(start);
+ while (*start && start < end) {
/* parse till end of line and store the start of next line. */
chptr = start;
while (*chptr != '\n') chptr++;
@@ -588,6 +589,7 @@ static int I2OGetDevices(struct knownDevices * devices) {
}
} /* end of if it is an i2o device */
start = next;
+ end = start + strlen(start);
} /* end of while */
bye:
free (buf);