Bug 1259719

Summary: hpithres, segmentation fault in case input closed
Product: Red Hat Enterprise Linux 7 Reporter: Jan Ščotka <jscotka>
Component: openhpiAssignee: Rafael Fonseca <rdossant>
Status: CLOSED ERRATA QA Contact: Radka Brychtova <rskvaril>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.1CC: ovasik, rskvaril, salmy
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.4.0-4 Doc Type: No Doc Update
Doc Text:
Doc already covered by #1255041.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 04:35:22 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:
Bug Depends On:    
Bug Blocks: 1274397, 1289025, 1305230    

Description Jan Ščotka 2015-09-03 12:23:25 UTC
Hi,
I've tested to use command: hpithres, and in case stdin is closed, witout quit command it causes SegFault

Version-Release number of selected component (if applicable):
hpithres - This program came with OpenHPI 3.4.0


How reproducible:
100%

Steps to Reproduce:
1.  echo "rpt" | hpithres

Actual results:
hpithres - This program came with OpenHPI 3.4.0
SAF HPI Version B.03.02

Available commands:
	exit, quit, q		- exit
	help, h			- this instruction
	rpt			- show all RPT entries
	rpt <id>		- show #id RPT entry
	rdr			- show all RDR entries
	rdr <rptid>		- show RDRs entries for #rptid
	rdr <rptid> <rdrid>	- show #rdrid RDR entry for #rptid
	sen			- show all sensors
	sen <rptid>		- show sensors for #rptid
	sen <rptid> <num>	- show #num sensor for #rptid
	mod			- modify thresholds
	undo			- delete all changes
==> rpt
  0 RPT: id =  16  ResourceId =  16  Tag = Chassis 1
  1 RPT: id =  17  ResourceId =  17  Tag = CPU 1
  2 RPT: id =  18  ResourceId =  18  Tag = DASD 1 1
  3 RPT: id =  19  ResourceId =  19  Tag = HS DASD 1 2
  4 RPT: id =  20  ResourceId =  20  Tag = Fan 1
  5 RPT: id =  21  ResourceId =  21  Tag = Chassis 3
  6 RPT: id =  22  ResourceId =  22  Tag = CPU 1
  7 RPT: id =  23  ResourceId =  23  Tag = DASD 1 1
  8 RPT: id =  24  ResourceId =  24  Tag = HS DASD 1 2
  9 RPT: id =  25  ResourceId =  25  Tag = Fan 1
 10 RPT: id =  26  ResourceId =  26  Tag = Chassis 4
 11 RPT: id =  27  ResourceId =  27  Tag = CPU 1
 12 RPT: id =  28  ResourceId =  28  Tag = DASD 1 1
 13 RPT: id =  29  ResourceId =  29  Tag = HS DASD 1 2
 14 RPT: id =  30  ResourceId =  30  Tag = Fan 1
==> Segmentation fault


Expected results:
no segfault but finish correctly

    Regards
    Honza

Comment 2 Rafael Fonseca 2015-09-03 12:53:55 UTC
Reported upstream with patch attached [1].

[1] https://sourceforge.net/p/openhpi/bugs/1899/

Comment 3 Rafael Fonseca 2015-09-04 15:41:26 UTC
Patch was accepted upstream and the fix is simple.

Comment 6 Radka Brychtova 2016-05-19 12:13:01 UTC
Old package :
openhpi-3.4.0-2.el7.x86_64

run :  echo "rpt" | hpithres 
:: [   FAIL   ] :: Test if there is no segmentation fault (Expected 0, got 139)

******************************************

New package:
 openhpi-3.4.0-3.el7.x86_64

run: echo "rpt" | hpithres 
:: [   PASS   ] :: Test if there is no segmentation fault (Expected 0, got 0)


As there is no segmentation fault in new package on all architectures => Verified

Comment 8 errata-xmlrpc 2016-11-04 04:35:22 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://rhn.redhat.com/errata/RHBA-2016-2357.html