Merge branch 'if4' into 'master'

lua: fix likely double-frees and use of undefined pointer state

See merge request videolan/vlc!1092
This commit is contained in:
Lyndon Brown 2024-04-28 07:11:05 +00:00
commit 700207c0b1
1 changed files with 5 additions and 0 deletions

View File

@ -176,13 +176,17 @@ static int vlclua_httpd_handler_callback(
char *no_password = NULL;
if (asprintf(&no_password, no_password_fmt,
_(no_password_title), _(no_password_body)) < 0) {
*pp_data = NULL;
*pi_data = 0;
} else {
size_t s = strlen(no_password);
if (asprintf((char**)pp_data, "Status: 403\n"
"Content-Length: %zu\n"
"Content-Type: text/html\n\n%s", s, no_password) < 0)
{
*pp_data = NULL;
*pi_data = 0;
}
else
*pi_data = strlen((char*)*pp_data);
free(no_password);
@ -284,6 +288,7 @@ static int vlclua_httpd_file_callback(
free(*pp_data);
if (asprintf((char**)pp_data, no_password_fmt,
_(no_password_title), _(no_password_body)) < 0) {
*pp_data = NULL;
*pi_data = 0;
} else {
*pi_data = strlen((char*)*pp_data);