Fix wrong size in strlcpy

This commit is contained in:
Tobias Reisinger 2020-11-14 00:04:14 +01:00
parent 1d6e8ff037
commit 5747a65664

View file

@ -344,7 +344,7 @@ router_find_endpoint(const char *uri_str, size_t uri_len, struct mg_str *method_
{ {
size_t arg_value_str_len = strlen(best_endpoint->args[i].value.v_str); size_t arg_value_str_len = strlen(best_endpoint->args[i].value.v_str);
char *arg_value_str = malloc(sizeof(char) * (arg_value_str_len + 1)); char *arg_value_str = malloc(sizeof(char) * (arg_value_str_len + 1));
strlcpy(arg_value_str, best_endpoint->args[i].value.v_str, arg_value_str_len); strlcpy(arg_value_str, best_endpoint->args[i].value.v_str, arg_value_str_len + 1);
best_endpoint->args[i].value.v_str = arg_value_str; best_endpoint->args[i].value.v_str = arg_value_str;
} }
} }