Patchwork [for-danny] relocate_sdk.py: new interpreter string was not '\0' terminated

login
register
mail settings
Submitter Denys Dmytriyenko
Date Feb. 8, 2013, 5:12 a.m.
Message ID <1360300321-4543-1-git-send-email-denis@denix.org>
Download mbox | patch
Permalink /patch/44311/
State New
Headers show

Comments

Denys Dmytriyenko - Feb. 8, 2013, 5:12 a.m.
From: Laurentiu Palcu <laurentiu.palcu@intel.com>

The problem: SDK binaries were not properly relocated when the SDK
was installed into a path that had a length less than the default one.
Apparently, there were two problems here: the padding was done wrong
(the size of one program header table entry was used instead of the
program section size) and the new padded string was not used at all.

[YOCTO #3655]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 scripts/relocate_sdk.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Ross Burton - Feb. 8, 2013, 11:27 a.m.
On 8 February 2013 05:12, Denys Dmytriyenko <denis@denix.org> wrote:
> From: Laurentiu Palcu <laurentiu.palcu@intel.com>
>
> The problem: SDK binaries were not properly relocated when the SDK
> was installed into a path that had a length less than the default one.
> Apparently, there were two problems here: the padding was done wrong
> (the size of one program header table entry was used instead of the
> program section size) and the new padded string was not used at all.
>
> [YOCTO #3655]

Merged to danny-next.

Ross

Patch

diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py
index 637ffe9..74bb7a5 100755
--- a/scripts/relocate_sdk.py
+++ b/scripts/relocate_sdk.py
@@ -89,8 +89,8 @@  def change_interpreter():
         if p_type == 3:
             # PT_INTERP section
             f.seek(p_offset)
-            dl_path = new_dl_path + "\0" * (e_phentsize - len(new_dl_path))
-            f.write(new_dl_path)
+            dl_path = new_dl_path + "\0" * (p_filesz - len(new_dl_path))
+            f.write(dl_path)
             break
 
 def change_dl_sysdirs():