1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-01 06:27:04 +03:00

fix: fixed the posible read of NULL when strdup fails thus resulting in

rpl->filename being NULL by setting an error signalling that we ran out
of memory to ease the debugging of the mariadb_rpl_options function and make
it clearer if it ever fails because of this. Also added va_end in this case to
avoid the va_list (ap) leaking when we return from this function and
then returning 1 from the fucntion.
This commit is contained in:
Pavol Sloboda
2025-04-14 11:47:59 +02:00
committed by Georg Richter
parent 5ea5d7ae01
commit 92a8b3b529

View File

@ -1982,6 +1982,12 @@ int STDCALL mariadb_rpl_optionsv(MARIADB_RPL *rpl,
else if (arg1)
{
rpl->filename= strdup((const char *)arg1);
if (!rpl->filename)
{
va_end(ap);
rpl_set_error(rpl, CR_OUT_OF_MEMORY, 0);
return 1;
}
rpl->filename_length= (uint32_t)strlen(rpl->filename);
}
break;