Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1631609

Summary: [RHEL7] BAD_FREE: "free" frees incorrect pointer "tmp" found by covscan in "libtirpc-0.2.4-0.15.el7" package
Product: Red Hat Enterprise Linux 7 Reporter: Zhi Li <yieli>
Component: libtirpcAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Zhi Li <yieli>
Severity: urgent Docs Contact:
Priority: high    
Version: 7.6CC: jiyin, rhandlin, xzhou, yoyang
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libtirpc-0.2.4-0.16.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1631614 (view as bug list) Environment:
Last Closed: 2019-08-06 12:40:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zhi Li 2018-09-21 03:47:24 UTC
Description of problem:
Please note there is a new Covscan defect need inspection:

Error: BAD_FREE (CWE-763): [#def11]
libtirpc-0.2.4/src/getnetconfig.c:708: address_assign: Assigning: "tmp" = "strchr(tmp, 0) + 1".
libtirpc-0.2.4/src/getnetconfig.c:714: incorrect_free: "free" frees incorrect pointer "tmp".
#  712|   	free(p->nc_netid);
#  713|   	free(p);
#  714|-> 	free(tmp);
#  715|   	return(NULL);
#  716|       }


Version-Release number of selected component (if applicable):
libtirpc-0.2.4-0.15.el7


Additional info:
The address originally returned by malloc() needs to be stored to be freed later on, not the shifted value of the address.

https://cov01.lab.eng.brq.redhat.com/covscanhub/waiving/24664/89669/#defects

Comment 2 Steve Dickson 2018-10-06 13:50:20 UTC
commit 959b2001458bca8f9228014371aad6ccbeb95a68 (HEAD -> master, origin/master, origin/HEAD)
Author: Zhi Li <yieli>
Date:   Wed Sep 26 14:05:29 2018 -0400

    getnetconfig.c: fix a BAD_FREE (CWE-763)
    
    Signed-off-by: Steve Dickson <steved>

Comment 9 errata-xmlrpc 2019-08-06 12:40:15 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, 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-2019:2061