http: fix potential memory corruption

This commit is contained in:
Kamil Trzcinski
2023-06-01 23:05:09 +02:00
parent e3a4d2768f
commit e1a5f987c4
3 changed files with 11 additions and 8 deletions

View File

@ -87,12 +87,12 @@ void *http_enum_params(http_worker_t *worker, FILE *stream, http_param_fn fn, vo
static void *http_get_param_fn(struct http_worker_s *worker, FILE *stream, const char *key, const char *value, void *opaque)
{
if (!strcmp(key, opaque))
return (void*)value;
return (void*)strdup(value);
return NULL;
}
const char *http_get_param(http_worker_t *worker, const char *key)
char *http_get_param(http_worker_t *worker, const char *key)
{
return http_enum_params(worker, NULL, http_get_param_fn, (void*)key);
}