You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +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:
committed by
Georg Richter
parent
5ea5d7ae01
commit
92a8b3b529
@@ -1982,6 +1982,12 @@ int STDCALL mariadb_rpl_optionsv(MARIADB_RPL *rpl,
|
|||||||
else if (arg1)
|
else if (arg1)
|
||||||
{
|
{
|
||||||
rpl->filename= strdup((const char *)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);
|
rpl->filename_length= (uint32_t)strlen(rpl->filename);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user