Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openvpn.c: handle strdup failure #693

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions openvpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,11 @@ OnPassword(connection_t *c, char *msg)
param->flags |= FLAG_CR_TYPE_SCRV1;
param->flags |= (*(chstr + 3) != '0') ? FLAG_CR_ECHO : 0;
param->str = strdup(chstr + 5);
if (!param->str)
{
WriteStatusLog(c, L"GUI> ", L"Error: Out of memory - ignoring dynamic challenge", false);
Copy link
Collaborator

@selvanair selvanair Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually static challenge :) That said, param->str is later used as if (param->str) { <display the string> } so failure here only leads to the challenge prompt string in the dialog displayed as empty, not a fatal error.

That said, erroring out here like this is fine too -- once out of memory the process is going to die sooner or later anyway.

return;
}
LocalizedDialogBoxParamEx(ID_DLG_AUTH_CHALLENGE, c->hwndStatus, UserAuthDialogFunc, (LPARAM) param);
}
else
Expand Down
Loading