aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-06-15 14:15:58 -0500
committerMark Hatle <mark.hatle@windriver.com>2010-07-22 18:46:34 -0500
commit3e1b95b7a22be319dea33b0683a93486971d558a (patch)
tree84ea1d97dfeab1cf26b2064730793d2182d5e2c9
parent6b087faf9f37f28fd6b4caedbf6d7b7c3b2ab180 (diff)
downloadprelink-cross-3e1b95b7a22be319dea33b0683a93486971d558a.tar.gz
prelink-cross-3e1b95b7a22be319dea33b0683a93486971d558a.tar.bz2
prelink-cross-3e1b95b7a22be319dea33b0683a93486971d558a.zip
Fix buffer overrun in load_ld_so_conf
2009-04-27 Maciej W. Rozycki <macro@codesourcery.com> Issue #5165 * src/ld-libs.c (load_ld_so_conf): Fix a buffer overrun. Don't record empty paths.
-rw-r--r--trunk/ChangeLog.cross6
-rw-r--r--trunk/src/ld-libs.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/trunk/ChangeLog.cross b/trunk/ChangeLog.cross
index 7e5d2e3..33f9a85 100644
--- a/trunk/ChangeLog.cross
+++ b/trunk/ChangeLog.cross
@@ -1,3 +1,9 @@
+2009-04-27 Maciej W. Rozycki <macro@codesourcery.com>
+ Issue #5165
+ * src/ld-libs.c (load_ld_so_conf): Fix a buffer overrun. Don't
+ record empty paths.
+
+
2009-04-23 Maciej W. Rozycki <macro@codesourcery.com>
Issue #5165
diff --git a/trunk/src/ld-libs.c b/trunk/src/ld-libs.c
index f5cf629..fe758b8 100644
--- a/trunk/src/ld-libs.c
+++ b/trunk/src/ld-libs.c
@@ -390,10 +390,11 @@ load_ld_so_conf (int use_64bit, int use_mipsn32)
if (p)
*p = 0;
len = strlen (buf);
- while (isspace (buf[len - 1]))
+ while (len > 0 && isspace (buf[len - 1]))
buf[--len] = 0;
- add_dir (&ld_dirs, buf, len);
+ if (len > 0)
+ add_dir (&ld_dirs, buf, len);
}
fclose (conf);
}