Bug 211484

Summary: CVE-2006-4810 texindex buffer overflow
Product: Red Hat Enterprise Linux 4 Reporter: Josh Bressers <bressers>
Component: texinfoAssignee: Miloslav Trmač <mitr>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=moderate,source=redhat,embargo=yes,reported=20061014,public=20061108
Fixed In Version: RHSA-2006-0727 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-08 10:02:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Josh Bressers 2006-10-19 17:42:00 UTC
Miloslav Trmac found a heap overflow in the way texindex handles data from
certain index files.

The texindex utility contains a heap overflow; when the data for a
generated index is larger than 500,000 bytes, an incorrect reallocation
code in readline() allows heap overflow by index lines longer than 400
bytes.


It looks like the code in readline() of texindex.c has some crazy arithmetic.

 char *buffer = linebuffer->buffer;
 char *p = linebuffer->buffer;
 char *end = p + linebuffer->size;

 while (1)
 {
  int c = getc (stream);
  if (p == end)
  {
   buffer = (char *) xrealloc (buffer, linebuffer->size *= 2);
   p += buffer - linebuffer->buffer;
   end += buffer - linebuffer->buffer;
   linebuffer->buffer = buffer;

It would seem that when p == end, p and end are assigned what could be a random
memory addresses as the location of buffer is likely to change with a realloc
from a size of 200 to 400 bytes. p then proceedes to dump trash on the heap
until the current line ends.

Comment 1 Josh Bressers 2006-10-19 17:44:11 UTC
This issue also affects RHEL2 and RHEL3

Comment 7 Mark J. Cox 2006-11-08 08:56:29 UTC
removing embargo

Comment 8 Red Hat Bugzilla 2006-11-08 10:02:24 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2006-0727.html