Skip to content

Commit

Permalink
fix off-by-one size restriction in string chunk allocation; apply sam…
Browse files Browse the repository at this point in the history
…e fixes to ctrl entity string allocator
  • Loading branch information
ryanfleury committed Jan 6, 2025
1 parent d70ce64 commit bc44f58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ctrl/ctrl_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ ctrl_entity_string_alloc(CTRL_EntityStore *store, String8 string)
n != 0;
prev = n, n = n->next)
{
if(n->size >= string.size+1)
if(n->size >= string.size)
{
if(prev == 0)
{
Expand Down Expand Up @@ -711,6 +711,7 @@ ctrl_entity_string_alloc(CTRL_EntityStore *store, String8 string)
}
U8 *chunk_memory = push_array(store->arena, U8, chunk_size);
node = (CTRL_EntityStringChunkNode *)chunk_memory;
node->size = chunk_size;
}

// rjf: fill string & return
Expand Down
2 changes: 1 addition & 1 deletion src/raddbg/raddbg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ rd_name_alloc(String8 string)
n != 0;
prev = n, n = n->next)
{
if(n->size >= string.size+1)
if(n->size >= string.size)
{
if(prev == 0)
{
Expand Down

0 comments on commit bc44f58

Please sign in to comment.