Bug 890225

Summary: new_line gets truncated in merge_group_entries
Product: Red Hat Enterprise Linux 6 Reporter: Brad Hubbard <bhubbard>
Component: shadow-utilsAssignee: Tomas Mraz <tmraz>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 6.3Keywords: Patch
Target Milestone: rc   
Target Release: 6.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-04 14:15:02 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: 947775, 947782    
Attachments:
Description Flags
Add one to new_line_length to accommodate new line char none

Description Brad Hubbard 2012-12-25 22:00:52 UTC
Created attachment 669050 [details]
Add one to new_line_length to accommodate new line char

Description of problem:
Whilst investigating BZ 890222 I discovered a problem in the following code.

Allowance is made for the terminating NULL in new_line_len but not the newline char that is added when the two lines are concatenated. The result is new_line ends up one character short.

314 /* Concatenate the 2 lines */
315 new_line_len = strlen (gr1->line) + strlen (gr2->line) +1;
316 new_line = (char *)malloc ((new_line_len + 1) * sizeof(char*));
317 if (NULL == new_line) {
318 errno = ENOMEM;
319 return NULL;
320 }
321 snprintf(new_line, new_line_len, "%s\n%s", gr1->line, gr2->line);
322 new_line[new_line_len] = '\0';

Patch attached.


Version-Release number of selected component (if applicable):
shadow-utils-4.1.4.2-13.el6.x86_64

Additional info:
Reported and patch submitted upstream.

https://alioth.debian.org/tracker/index.php?func=detail&aid=313942&group_id=30580&atid=411478

Comment 1 RHEL Program Management 2013-10-14 00:07:00 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 2 Tomas Mraz 2014-06-04 14:15:02 UTC
We will fix this with one patch.

*** This bug has been marked as a duplicate of bug 890222 ***