Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1364692 - jwhois segfaults when /etc/jwhois.conf is not accessible
Summary: jwhois segfaults when /etc/jwhois.conf is not accessible
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: jwhois
Version: epel7
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Vitezslav Crhonek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-06 09:46 UTC by Christopher Arnold
Modified: 2016-08-23 19:23 UTC (History)
2 users (show)

Fixed In Version: jwhois-4.0-45.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-23 19:23:15 UTC


Attachments (Terms of Use)
Fixed jwhois fclose patch (deleted)
2016-08-06 09:46 UTC, Christopher Arnold
no flags Details | Diff

Description Christopher Arnold 2016-08-06 09:46:21 UTC
Created attachment 1188131 [details]
Fixed jwhois fclose patch

Description of problem:
When jwhois.conf is not accessible, /usr/bin/jwhois segfaults. This appears to be the result of attempting to erroneously fclose() a null FILE pointer. This is mostly observed in chrooted environments.

Version-Release number of selected component (if applicable):
$ rpm -qa | grep jwhois
jwhois-4.0-44.el7.centos.x86_64
jwhois-debuginfo-4.0-44.el7.x86_64


How reproducible:
Yes

Steps to Reproduce:
1. Install jwhois package
2. Remove /etc/jwhois.conf or otherwise make open("/etc/jwhois.conf", "r") fail
3. `jwhois example.com`

# yum install jwhois -q -y && rm -f /etc/jwhois.conf && ulimit -c unlimited && jwhois example.com
Segmentation fault (core dumped)
#


Actual results:
jwhois segfaults;

 (gdb) bt full
 #0  _IO_new_fclose (fp=0x0) at iofclose.c:54
         status = <optimized out>
 #1  0x0000000000404100 in parse_args (argc=argc@entry=0x7ffd58936eac,
     argv=argv@entry=0x7ffd58936ea0) at init.c:286
         optch = <optimized out>
         option_index = 32583
         ret = 0xa <Address 0xa out of bounds>
         in = <optimized out>
 #2  0x00000000004020e8 in main (argc=2, argv=0x7ffd58937008) at jwhois.c:95
         optind = <optimized out>
         count = 0
         ret = 0
         rc = 0
         qstring = 0x0
         text = 0x7ffd58936f30 ""
         idn = 0x7ffd58936f40 ""
         wq = {host = 0x0, port = 0, query = 0x0, domain = 0x0}



Expected results:
whois text printed to stdout

Additional info:
It looks like the issue is within jwhois-4.0-fclose.patch which has an fclose call outside the scope of the proceeding null pointer check. I was able to rebuild the sRPM with the attached patch, which appears to correct the issue. I have selected el7, since that applies to the package I replicated the issue with; however, the issue was originally observed on a system which uses el6, and I would expect any RPM with this patch applied to be affected.

Comment 1 Vitezslav Crhonek 2016-08-08 11:16:02 UTC
Hello Christopher,

Thanks for the bug report and investigation, your conclusion is correct indeed.

Fixed in EPEL7 and in Fedora Rawhide.

Comment 2 Fedora Update System 2016-08-08 11:26:37 UTC
jwhois-4.0-45.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-db9b2232e4

Comment 3 Fedora Update System 2016-08-09 02:19:22 UTC
jwhois-4.0-45.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-db9b2232e4

Comment 4 Fedora Update System 2016-08-23 19:23:12 UTC
jwhois-4.0-45.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


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