1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-26 19:39:53 +03:00

Merge PR #845: Cedar/IPC.c: fix memory leak occurring when both the username and common name are not present (OpenVPN)

This commit is contained in:
Davide Beatrici 2018-12-23 11:35:47 +01:00 committed by GitHub
commit fca10c0975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -433,6 +433,13 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
{ {
p = PackLoginWithPlainPassword(hubname, username, password); p = PackLoginWithPlainPassword(hubname, username, password);
} }
if (p == NULL)
{
err = ERR_AUTH_FAILED;
goto LABEL_ERROR;
}
PackAddStr(p, "hello", client_name); PackAddStr(p, "hello", client_name);
PackAddInt(p, "client_ver", cedar->Version); PackAddInt(p, "client_ver", cedar->Version);
PackAddInt(p, "client_build", cedar->Build); PackAddInt(p, "client_build", cedar->Build);

View File

@ -7126,6 +7126,7 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
{ {
if (x->subject_name == NULL) if (x->subject_name == NULL)
{ {
FreePack(p);
return NULL; return NULL;
} }
UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName); UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName);