Replace % characters in param->id as it's used in format template

Found by ZeroPath

Reported by: Joshua Rogers <joshua@joshua.hu>

Signed-off-by: Selva Nair <selva.nair@gmail.com>
master
Selva Nair 2025-10-25 16:55:49 -04:00 committed by Lev Stipakov
parent dab4dffa6b
commit fff2048802
1 changed files with 15 additions and 0 deletions

View File

@ -75,6 +75,20 @@ static BOOL LaunchOpenVPN(connection_t *c);
const TCHAR *cfgProp = _T("conn");
/* Replace excluded characters by specified one */
static void
string_mod(char *in, const char *exclude, char replace)
{
while (*in)
{
if (strchr(exclude, *in))
{
*in = replace;
}
in++;
}
}
void
free_auth_param(auth_param_t *param)
{
@ -997,6 +1011,7 @@ GenericPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
fmt = malloc(strlen(template) + strlen(param->id));
if (fmt)
{
string_mod(param->id, "%", '_');
sprintf(fmt, template, param->id);
PrintDebug(L"Send passwd to mgmt with format: '%hs'", fmt);
ManagementCommandFromInput(param->c, fmt, hwndDlg, ID_EDT_RESPONSE);