Sourceware Bugzilla – Attachment 7909 Details for
Bug 17552
strip/objcopy: directory traversal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Cleanup temporary files on error
objcopy.diff (text/plain), 2.02 KB, created by
Nick Clifton
on 2014-11-06 15:32:51 UTC
(
hide
)
Description:
Cleanup temporary files on error
Filename:
MIME Type:
Creator:
Nick Clifton
Created:
2014-11-06 15:32:51 UTC
Size:
2.02 KB
patch
obsolete
>diff --git a/binutils/objcopy.c b/binutils/objcopy.c >index 8454bc6..07794cb 100644 >--- a/binutils/objcopy.c >+++ b/binutils/objcopy.c >@@ -2298,8 +2298,12 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, > /* PR binutils/17533: Do not allow directory traversal > outside of the current directory tree by archive members. */ > if (! is_valid_archive_path (bfd_get_filename (this_element))) >- fatal (_("illegal pathname found in archive member: %s"), >- bfd_get_filename (this_element)); >+ { >+ non_fatal (_("illegal pathname found in archive member: %s"), >+ bfd_get_filename (this_element)); >+ status = 1; >+ goto cleanup_and_exit; >+ } > > /* Create an output file for this member. */ > output_name = concat (dir, "/", >@@ -2310,8 +2314,12 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, > { > output_name = make_tempdir (output_name); > if (output_name == NULL) >- fatal (_("cannot create tempdir for archive copying (error: %s)"), >- strerror (errno)); >+ { >+ non_fatal (_("cannot create tempdir for archive copying (error: %s)"), >+ strerror (errno)); >+ status = 1; >+ goto cleanup_and_exit; >+ } > > l = (struct name_list *) xmalloc (sizeof (struct name_list)); > l->name = output_name; >@@ -2353,7 +2361,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, > { > bfd_nonfatal_message (output_name, NULL, NULL, NULL); > status = 1; >- return; >+ goto cleanup_and_exit; > } > > if (ok_object) >@@ -2414,7 +2422,6 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, > { > status = 1; > bfd_nonfatal_message (filename, NULL, NULL, NULL); >- return; > } > > filename = bfd_get_filename (ibfd); >@@ -2422,9 +2429,9 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, > { > status = 1; > bfd_nonfatal_message (filename, NULL, NULL, NULL); >- return; > } > >+ cleanup_and_exit: > /* Delete all the files that we opened. */ > for (l = list; l != NULL; l = l->next) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 17552
:
7899
|
7909
|
7913