RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2135405 - bindresvport.c:132: Opened stream never closed. Potential resource leak in an return path
Summary: bindresvport.c:132: Opened stream never closed. Potential resource leak in an...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libtirpc
Version: 9.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Steve Dickson
QA Contact: Zhi Li
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-10-17 14:31 UTC by Zhi Li
Modified: 2023-05-09 10:27 UTC (History)
3 users (show)

Fixed In Version: libtirpc-1.3.3-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 08:19:31 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-136711 0 None None None 2022-10-17 14:34:53 UTC
Red Hat Product Errata RHBA-2023:2506 0 None None None 2023-05-09 08:19:32 UTC

Description Zhi Li 2022-10-17 14:31:47 UTC
Description of problem:
A potential leak of fd issue has been found on /root/libtirpc-1.3.3/src/bindresvport.c inside libtirpc-1.1.3.el9.

bindresvport.c: opened stream never closed. Potential resource leak

static void
load_blacklist (void)
{
  FILE *fp;
  char *buf = NULL;
  size_t buflen = 0;
  int size = 0, ptr = 0;

  blacklist_read = 1;

  fp = fopen ("/etc/bindresvport.blacklist", "r");
  if (NULL == fp)
    return;

  while (!feof (fp))
    {
-- snip --

      if (ptr >= size)
	{
	  size += 10;
	  list = realloc (list, size * sizeof (int));
	  if (list == NULL)
	    {
	      free (buf);
	      return; // << it didnot close fp in this return path
	    }
	}

      list[ptr++] = port;
    }

  fclose (fp); // << fp closed in this return path

  if (buf)
    free (buf);

  list_size = ptr;
}

Version-Release number of selected component (if applicable):
libtirpc-1.1.3.el9

Actual results:
Potential leak of fd

Expected results:
No potential leak of fd

Additional info:

Comment 1 Steve Dickson 2022-10-25 14:38:24 UTC
commit 55526c52a449907e4d34b829b96141afab530b23 (HEAD -> master, origin/master, origin/HEAD)
Author: Zhi Li <yieli>
Date:   Mon Oct 24 13:46:54 2022 -0400

    bindresvport.c: fix a potential resource leakage
    
    Close the FILE *fp of load_blacklist() in another
    return path to avoid potential resource leakage.

Comment 6 errata-xmlrpc 2023-05-09 08:19:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (libtirpc bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2506


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