Fix snafu parsing $ORIGIN.
authorNick Clifton <nickc@redhat.com>
Thu, 24 Nov 2016 10:00:20 +0000 (10:00 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 24 Nov 2016 10:00:20 +0000 (10:00 +0000)
PR ld/20858
* emultempl/elf32.em (_search_needed): Allow for path separator
and terminating NUL byte when allocating space for new $ORIGIN
path.

ld/ChangeLog
ld/emultempl/elf32.em

index 9c5eb404543719704816c274dc44cfb39927eb2a..0747409a899a96cfa6151bd0e886c97e5e890dc5 100644 (file)
@@ -1,3 +1,10 @@
+2016-11-24  Nick Clifton  <nickc@redhat.com>
+
+       PR ld/20858
+       * emultempl/elf32.em (_search_needed): Allow for path separator
+       and terminating NUL byte when allocating space for new $ORIGIN
+       path.
+
 2016-11-23  Nick Clifton  <nickc@redhat.com>
 
        * testsuite/ld-arm/vxworks2.sd: Update expected readelf output.
index 8c6363808ee4e793742fdaf9148a67e63787bcd9..f5cb3eeb71862fb428f9347e50cabe204f49a58f 100644 (file)
@@ -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);
                        }
 
This page took 0.029212 seconds and 4 git commands to generate.