diff options
author | pfg <pfg@FreeBSD.org> | 2014-08-28 18:11:05 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-08-28 18:11:05 +0000 |
commit | 564b330f17f47a63364f8c45c76c24493a627165 (patch) | |
tree | 3d904b740bbafd0a43dee99599d230f2e5384ec4 /libexec | |
parent | d3edf358e534ec56f98b2f0a586698b9621b6fa7 (diff) | |
download | FreeBSD-src-564b330f17f47a63364f8c45c76c24493a627165.zip FreeBSD-src-564b330f17f47a63364f8c45c76c24493a627165.tar.gz |
MFC r270256:
Always check the limits of array index variables before using them.
Obtained from: DragonFlyBSD
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/libmap.c | 4 |
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++; |