diff options
author | Matt Wilson <msw@redhat.com> | 2001-02-28 06:39:27 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 2001-02-28 06:39:27 +0000 |
commit | 546e833acbae52530446028c2f0e8f79bd438cce (patch) | |
tree | 2dd370150334aeda595ce5f83b502176de349726 /isys/probe.c | |
parent | f7ebcff60d81bfd1b2817f27c9ff901b4d0e64fc (diff) | |
download | anaconda-546e833acbae52530446028c2f0e8f79bd438cce.tar.gz anaconda-546e833acbae52530446028c2f0e8f79bd438cce.tar.xz anaconda-546e833acbae52530446028c2f0e8f79bd438cce.zip |
be paranoid about walking off the end
Diffstat (limited to 'isys/probe.c')
-rw-r--r-- | isys/probe.c | 6 |
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); |