mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 21:38:40 +00:00
fix off-by-one size restriction in string chunk allocation; apply same fixes to ctrl entity string allocator
This commit is contained in:
@@ -676,7 +676,7 @@ ctrl_entity_string_alloc(CTRL_EntityStore *store, String8 string)
|
|||||||
n != 0;
|
n != 0;
|
||||||
prev = n, n = n->next)
|
prev = n, n = n->next)
|
||||||
{
|
{
|
||||||
if(n->size >= string.size+1)
|
if(n->size >= string.size)
|
||||||
{
|
{
|
||||||
if(prev == 0)
|
if(prev == 0)
|
||||||
{
|
{
|
||||||
@@ -711,6 +711,7 @@ ctrl_entity_string_alloc(CTRL_EntityStore *store, String8 string)
|
|||||||
}
|
}
|
||||||
U8 *chunk_memory = push_array(store->arena, U8, chunk_size);
|
U8 *chunk_memory = push_array(store->arena, U8, chunk_size);
|
||||||
node = (CTRL_EntityStringChunkNode *)chunk_memory;
|
node = (CTRL_EntityStringChunkNode *)chunk_memory;
|
||||||
|
node->size = chunk_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rjf: fill string & return
|
// rjf: fill string & return
|
||||||
|
|||||||
@@ -1126,7 +1126,7 @@ rd_name_alloc(String8 string)
|
|||||||
n != 0;
|
n != 0;
|
||||||
prev = n, n = n->next)
|
prev = n, n = n->next)
|
||||||
{
|
{
|
||||||
if(n->size >= string.size+1)
|
if(n->size >= string.size)
|
||||||
{
|
{
|
||||||
if(prev == 0)
|
if(prev == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user