Fix buffer overrun

FossilOrigin-Name: 7b784aa5b8f0a0f26b72d7459e02600e712a88e866091a599af1fb51c04baec4
This commit is contained in:
me@ow.nekobit.net 2022-04-03 01:51:28 +00:00
parent 45085805f3
commit e8f2a64a4f
2 changed files with 3 additions and 3 deletions

View file

@ -39,10 +39,10 @@ char* read_cookies_env(struct cookie_values* cookies)
if (!cookies_env)
return NULL;
char* cookies_str = malloc(strlen(cookies_env));
char* cookies_str = malloc(strlen(cookies_env) + 1);
if (!cookies_str)
{
printf("malloc");
perror("malloc");
return NULL;
}
strcpy(cookies_str, cookies_env);

View file

@ -66,7 +66,7 @@ int main(void)
api.token = ssn.cookies.access_token; // Load token now
char* post_str = read_post_data(&(ssn.post));
char* get_str = read_query_data(&(ssn.query));
/*******************
* Path handling *
******************/