Article View: gnu.utils.bug
Article #1582Gnumake 3.45 bugfix
From: david.e.bodenstab
Date: Fri, 28 Apr 1989 00:21
Date: Fri, 28 Apr 1989 00:21
55 lines
2139 bytes
2139 bytes
When variable_expand() is called, it uses variable_buffer_output() to
append strings to the end of variable_buffer. However, at the end of
variable_expand(), there is the line "*o = '\0';". If the length of the
string in variable_buffer is exactly the current size of variable_buffer,
the assignment to *o will corrupt memory. Also, when there is nothing
to expand (no '$' found), strlen(p)+1 was used in the call to
variable_buffer_output(). This results in an unnecessary double NUL
at the end of the string. The patch follows:
Dave Bodenstab
...att!iwsl8!imdave
*** /tmp/,RCSt1a19651 Thu Apr 27 19:00:59 1989
--- variable.c Thu Apr 27 18:59:36 1989
***************
*** 1356,1362
p1 = index (p, '$');
! o = variable_buffer_output (o, p, p1 != 0 ? p1 - p : strlen (p) + 1);
if (p1 == 0)
break;
--- 1356,1362 -----
p1 = index (p, '$');
! o = variable_buffer_output (o, p, p1 != 0 ? p1 - p : strlen (p));
if (p1 == 0)
break;
***************
*** 1586,1592
register unsigned int newlen = length + (ptr - variable_buffer);
register char *new;
! if (newlen > variable_buffer_length)
{
variable_buffer_length = max (2 * variable_buffer_length, newlen + 100);
new = (char *) xrealloc (variable_buffer, variable_buffer_length);
--- 1586,1592 -----
register unsigned int newlen = length + (ptr - variable_buffer);
register char *new;
! if (newlen >= variable_buffer_length)
{
variable_buffer_length = max (2 * variable_buffer_length, newlen + 100);
new = (char *) xrealloc (variable_buffer, variable_buffer_length);
<<< end of patch >>>
Technical Details
Message-ID:
<600@cbnewsc.ATT.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!labrea!bloom-beacon!tut.cis.ohio-state.edu!cs.utexas.edu!execu!sequoia!attdso!shuxd!att!cbnewsc!imdaveShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!labrea!bloom-beacon!tut.cis.ohio-state.edu!cs.utexas.edu!execu!sequoia!attdso!shuxd!att!cbnewsc!imdave From: imdave@cbnewsc.ATT.COM (david.e.bodenstab) Newsgroups: gnu.utils.bug Subject: Gnumake 3.45 bugfix Message-ID: <600@cbnewsc.ATT.COM> Date: 28 Apr 89 00:21:42 GMT Distribution: usa Organization: AT&T Bell Laboratories Lines: 55