[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #20452] Incorrect use of variable_buffer_output() in expand_deps()
From: |
Rafi Einstein |
Subject: |
[bug #20452] Incorrect use of variable_buffer_output() in expand_deps() [file.c] |
Date: |
Wed, 11 Jul 2007 21:12:46 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 |
URL:
<http://savannah.gnu.org/bugs/?20452>
Summary: Incorrect use of variable_buffer_output() in
expand_deps() [file.c]
Project: make
Submitted by: rafi_einstein
Submitted on: Thursday 07/12/2007 at 00:12
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: CVS
Operating System: Any
Fixed Release: None
_______________________________________________________
Details:
In expand_deps() [file.c], we do:
char *p;
...
p = variable_expand ("");
variable_buffer_output (p, d->name, strlen (d->name) + 1);
and then use p as if it was pointing to the beginning of the variable buffer
(aka variable_buffer).
For a large enough string (16KB will do), variable_buffer_output() will
reallocate the variable buffer, leaving p pointing to dark places.
What we should be doing following the variable_buffer_output() call is:
p = variable_buffer;
Subsequently, we do:
char *buffer = variable_expand ("");
o = subst_expand (buffer, d->name, "%", "$*", 1, 2, 0);
d->name = strcache_add_len (buffer, o - buffer);
Again, assuming 'buffer' represents the beginning of the variable buffer.
We should rather write:
d->name = strcache_add_len (o, o - variable_buffer);
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?20452>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #20452] Incorrect use of variable_buffer_output() in expand_deps() [file.c],
Rafi Einstein <=