aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-11-24 10:00:20 +0000
committerNick Clifton <nickc@redhat.com>2016-11-24 10:00:20 +0000
commit51750acd087cc20ae3f72393fa897d9e3059c65d (patch)
tree135edb7a0bc0031932a177817bcaa5c43a3b781b /ld/emultempl
parent0b14696aedc2b56291bc98d62fe232c8dceb1385 (diff)
downloadgdb-51750acd087cc20ae3f72393fa897d9e3059c65d.zip
gdb-51750acd087cc20ae3f72393fa897d9e3059c65d.tar.gz
gdb-51750acd087cc20ae3f72393fa897d9e3059c65d.tar.bz2
Fix snafu parsing $ORIGIN.
PR ld/20858 * emultempl/elf32.em (_search_needed): Allow for path separator and terminating NUL byte when allocating space for new $ORIGIN path.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em2
1 files changed, 1 insertions, 1 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 8c63638..f5cb3ee 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -585,7 +585,7 @@ gld${EMULATION_NAME}_search_needed (const char *path,
{
char * current_dir = getpwd ();
- freeme = xmalloc (strlen (replacement) + strlen (current_dir));
+ freeme = xmalloc (strlen (replacement) + strlen (current_dir) + 2);
sprintf (freeme, "%s/%s", current_dir, replacement);
}