summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/libmap.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-08-21 02:40:33 +0000
committerpfg <pfg@FreeBSD.org>2014-08-21 02:40:33 +0000
commit4f5a56e73cd28662dbe8f81787b0e69ff9e94950 (patch)
tree4246d524af7501e4f9968d21bc586d16a77a75fa /libexec/rtld-elf/libmap.c
parent5a060fa7839ed3be38abc8f964e12e79ec18cd11 (diff)
downloadFreeBSD-src-4f5a56e73cd28662dbe8f81787b0e69ff9e94950.zip
FreeBSD-src-4f5a56e73cd28662dbe8f81787b0e69ff9e94950.tar.gz
Always check the limits of array index variables before using them.
Obtained from: DragonFlyBSD MFC after: 1 week
Diffstat (limited to 'libexec/rtld-elf/libmap.c')
-rw-r--r--libexec/rtld-elf/libmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c
index 8b5faf8..691ad52 100644
--- a/libexec/rtld-elf/libmap.c
+++ b/libexec/rtld-elf/libmap.c
@@ -216,14 +216,14 @@ lmc_parse(char *lm_p, size_t lm_len)
p = NULL;
while (cnt < lm_len) {
i = 0;
- while (lm_p[cnt] != '\n' && cnt < lm_len &&
+ while (cnt < lm_len && lm_p[cnt] != '\n' &&
i < sizeof(line) - 1) {
line[i] = lm_p[cnt];
cnt++;
i++;
}
line[i] = '\0';
- while (lm_p[cnt] != '\n' && cnt < lm_len)
+ while (cnt < lm_len && lm_p[cnt] != '\n')
cnt++;
/* skip over nl */
cnt++;
OpenPOWER on IntegriCloud