Fixed memory allocation: allocated memory wasn't enough to store the

final 0 of the string.
parent 11e4e18c
...@@ -258,7 +258,7 @@ static int handle_default_option(void *in_ctx, const char *group_name, ...@@ -258,7 +258,7 @@ static int handle_default_option(void *in_ctx, const char *group_name,
ctx= (struct handle_option_ctx *) in_ctx; ctx= (struct handle_option_ctx *) in_ctx;
if(find_type((char *)group_name, ctx->group, 3)) if(find_type((char *)group_name, ctx->group, 3))
{ {
if (!(tmp= alloc_root(ctx->alloc, (uint) strlen(option)))) if (!(tmp= alloc_root(ctx->alloc, (uint) strlen(option) + 1)))
return 1; return 1;
if (insert_dynamic(ctx->args, (gptr) &tmp)) if (insert_dynamic(ctx->args, (gptr) &tmp))
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment