Bug 1247587 - Resource leak in ar.c:extract_file
Resource leak in ar.c:extract_file
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: binutils (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Nick Clifton
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-28 07:45 EDT by Miloš Prchlík
Modified: 2015-08-05 05:22 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-05 05:22:24 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Miloš Prchlík 2015-07-28 07:45:19 EDT
Description of problem:

Discovered by covscan: http://cov01.lab.eng.brq.redhat.com/covscanhub/waiving/10167/33969/#defects

1009   FILE *ostream;
1010   char *cbuf = (char *) xmalloc (BUFSIZE);
1011   bfd_size_type nread, tocopy;
1012   bfd_size_type ncopied = 0;
1013   bfd_size_type size;
1014   struct stat buf;
1015 
1016   /* PR binutils/17533: Do not allow directory traversal
1017      outside of the current directory tree.  */
1018   if (! is_valid_archive_path (bfd_get_filename (abfd)))
1019     {
1020       non_fatal (_("illegal pathname found in archive member: %s"),
1021                  bfd_get_filename (abfd));
1022       return;
1023     }

In case of !is_valid_archive_path() cbuf stays allocated, leading to a resource leak. Probably not a serious one, though...


Version-Release number of selected component (if applicable):

binutils-2.23.52.0.1-50.el7


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 Nick Clifton 2015-08-04 09:56:08 EDT
Hi Milos,

  The leak is now fixed in the mainline FSF development sources:

https://www.sourceware.org/ml/binutils/2015-08/msg00026.html

  Since the problem is so minor though, I see no reason to import the patch into 7.2 or DTS 4.0.  The fix will eventually makes its way into the DTS 5 sources, which should be soon enough.  Do you agree ?

Cheers
  Nick
Comment 2 Miloš Prchlík 2015-08-05 02:04:30 EDT
Sounds reasonable.

Note You need to log in before you can comment on or make changes to this bug.