Skip to content

Commit fff2048

Browse files
selvanairlstipakov
authored andcommitted
Replace % characters in param->id as it's used in format template
Found by ZeroPath Reported by: Joshua Rogers <[email protected]> Signed-off-by: Selva Nair <[email protected]>
1 parent dab4dff commit fff2048

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

openvpn.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ static BOOL LaunchOpenVPN(connection_t *c);
7575

7676
const TCHAR *cfgProp = _T("conn");
7777

78+
/* Replace excluded characters by specified one */
79+
static void
80+
string_mod(char *in, const char *exclude, char replace)
81+
{
82+
while (*in)
83+
{
84+
if (strchr(exclude, *in))
85+
{
86+
*in = replace;
87+
}
88+
in++;
89+
}
90+
}
91+
7892
void
7993
free_auth_param(auth_param_t *param)
8094
{
@@ -997,6 +1011,7 @@ GenericPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
9971011
fmt = malloc(strlen(template) + strlen(param->id));
9981012
if (fmt)
9991013
{
1014+
string_mod(param->id, "%", '_');
10001015
sprintf(fmt, template, param->id);
10011016
PrintDebug(L"Send passwd to mgmt with format: '%hs'", fmt);
10021017
ManagementCommandFromInput(param->c, fmt, hwndDlg, ID_EDT_RESPONSE);

0 commit comments

Comments
 (0)