aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorDave Korn <dave.korn@artimi.com>2010-10-15 16:09:36 +0000
committerDave Korn <dave.korn@artimi.com>2010-10-15 16:09:36 +0000
commitd4cb7acdd8134607c321fc33c91696d672f49b1d (patch)
treefb0910d987e3c31ef6c5ead5e16556a942d91ef4 /ld
parentc3842ce50ee3621b3289c1fbd64860c4e8c0cbd8 (diff)
downloadfsf-binutils-gdb-d4cb7acdd8134607c321fc33c91696d672f49b1d.zip
fsf-binutils-gdb-d4cb7acdd8134607c321fc33c91696d672f49b1d.tar.gz
fsf-binutils-gdb-d4cb7acdd8134607c321fc33c91696d672f49b1d.tar.bz2
Fix potential use-after-free bugs.
ld/ChangeLog: * plugin.c (add_input_file): Take copy of input string. (add_input_library): Likewise. (set_extra_library_path): Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/plugin.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d171298..85c784a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-15 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * plugin.c (add_input_file): Take copy of input string.
+ (add_input_library): Likewise.
+ (set_extra_library_path): Likewise.
+
2010-10-14 Dave Korn <dave.korn.cygwin@gmail.com>
Apply LD plugin patch series (part 6/6).
diff --git a/ld/plugin.c b/ld/plugin.c
index b484bd0..0c88ef8 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -433,7 +433,8 @@ static enum ld_plugin_status
add_input_file (const char *pathname)
{
ASSERT (called_plugin);
- if (!lang_add_input_file (pathname, lang_input_file_is_file_enum, NULL))
+ if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_file_enum,
+ NULL))
return LDPS_ERR;
return LDPS_OK;
}
@@ -443,7 +444,8 @@ static enum ld_plugin_status
add_input_library (const char *pathname)
{
ASSERT (called_plugin);
- if (!lang_add_input_file (pathname, lang_input_file_is_l_enum, NULL))
+ if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_l_enum,
+ NULL))
return LDPS_ERR;
return LDPS_OK;
}
@@ -454,7 +456,7 @@ static enum ld_plugin_status
set_extra_library_path (const char *path)
{
ASSERT (called_plugin);
- ldfile_add_library_path (path, FALSE);
+ ldfile_add_library_path (xstrdup (path), FALSE);
return LDPS_OK;
}