mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Merge remote-tracking branch 'origin/maint-0.2.4'
This commit is contained in:
commit
82ab33c9a6
6
changes/bug8844
Normal file
6
changes/bug8844
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
o Major bugfixes:
|
||||||
|
- Prevent the get_freelists() function from running off the end of
|
||||||
|
the list of freelists if it somehow gets an unrecognized
|
||||||
|
allocation. Fixes bug 8844; bugfix on 0.2.0.16-alpha. Reported by
|
||||||
|
eugenis.
|
||||||
|
|
@ -148,7 +148,8 @@ static INLINE chunk_freelist_t *
|
|||||||
get_freelist(size_t alloc)
|
get_freelist(size_t alloc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; freelists[i].alloc_size <= alloc; ++i) {
|
for (i=0; (freelists[i].alloc_size <= alloc &&
|
||||||
|
freelists[i].alloc_size); ++i ) {
|
||||||
if (freelists[i].alloc_size == alloc) {
|
if (freelists[i].alloc_size == alloc) {
|
||||||
return &freelists[i];
|
return &freelists[i];
|
||||||
}
|
}
|
||||||
|
@ -813,6 +813,18 @@ test_buffers(void)
|
|||||||
buf_free(buf);
|
buf_free(buf);
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
|
|
||||||
|
/* Try adding a string too long for any freelist. */
|
||||||
|
{
|
||||||
|
char *cp = tor_malloc_zero(65536);
|
||||||
|
buf = buf_new();
|
||||||
|
write_to_buf(cp, 65536, buf);
|
||||||
|
tor_free(cp);
|
||||||
|
|
||||||
|
tt_int_op(buf_datalen(buf), ==, 65536);
|
||||||
|
buf_free(buf);
|
||||||
|
buf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (buf)
|
if (buf)
|
||||||
buf_free(buf);
|
buf_free(buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user