Bug 890225 - new_line gets truncated in merge_group_entries
new_line gets truncated in merge_group_entries
Status: CLOSED DUPLICATE of bug 890222
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: shadow-utils (Show other bugs)
Unspecified Unspecified
low Severity low
: rc
: 6.5
Assigned To: Tomas Mraz
BaseOS QE Security Team
: Patch
Depends On:
Blocks: 947775 947782
  Show dependency treegraph
Reported: 2012-12-25 17:00 EST by Brad Hubbard
Modified: 2014-06-04 10:15 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-06-04 10:15:02 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Add one to new_line_length to accommodate new line char (493 bytes, patch)
2012-12-25 17:00 EST, Brad Hubbard
no flags Details | Diff

  None (edit)
Description Brad Hubbard 2012-12-25 17:00:52 EST
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):

Additional info:
Reported and patch submitted upstream.

Comment 1 RHEL Product and Program Management 2013-10-13 20:07:00 EDT
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 10:15:02 EDT
We will fix this with one patch.

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

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