Bug 1591141

Summary: abrt-action-save-package-data dies in segfault
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: abrtAssignee: abrt <abrt-devel-list>
Status: CLOSED ERRATA QA Contact: Martin Kyral <mkyral>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: mkyral, mmarusak
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 11:41:45 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 Renaud Métrich 2018-06-14 07:19:56 UTC
Description of problem:

When searching for the GPGKeysDir entry in /etc/abrt/gpg_keys.conf, not finding the entry results in comparing against a NULL pointer:

Core was generated by `abrt-action-save-package-data'.
Program terminated with signal 11, Segmentation fault.
#0  load_gpg_keys () at abrt-action-save-package-data.c:91
91	    if (strcmp(gpg_keys_dir, "") != 0)

(gdb) disassemble
...
   0x0000561da0a4fe64 <+964>:	mov    %rbp,%rdi
   0x0000561da0a4fe67 <+967>:	callq  0x561da0a4f8d0 <g_hash_table_lookup@plt>
=> 0x0000561da0a4fe6c <+972>:	cmpb   $0x0,(%rax)

(gdb) printf "0x%lx\n", $rax
0x0

(gdb) list
86	        error_msg("Can't load '%s'", GPG_CONF);
87	        return;
88	    }
89	
90	    const char *gpg_keys_dir = get_map_string_item_or_NULL(settings, "GPGKeysDir");
91	    if (strcmp(gpg_keys_dir, "") != 0)

--> Line 91: comparison against NULL pointer ("gpg_keys_dir")


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

abrt-2.1.11-50.el7.x86_64 but also previous releases


How reproducible:

Don't know how to build "GPGKeysDir" to make that fail.


Additional info:

get_map_string_item_or_empty() should be used instead of get_map_string_item_or_NULL.

Comment 2 Matej Habrnal 2018-06-14 12:48:44 UTC
Thank you for the bug report!

This commit fixes this bug
https://github.com/abrt/abrt/commit/22516be4cea566c3eafc73e318e035defe59cea5

Will be backported to RHEL 7.6

Comment 8 errata-xmlrpc 2018-10-30 11:41:45 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-2018:3285