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

sam: fix using pointer to local variable that is out of scope

This commit is contained in:
Georgy Komarov 2020-03-27 07:28:43 +03:00
parent 1416a693e7
commit 4772a508dc
No known key found for this signature in database
GPG Key ID: 195B8622FE88ED46

View File

@ -114,7 +114,10 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna
char buffer[255]; char buffer[255];
char ntlm_timeout[32]; char ntlm_timeout[32];
char* proc_parameter[6]; char* proc_parameter[6];
// DNS Name 255 chars + OU names are limited to 64 characters + cmdline 32 + 1
char requiremember[352];
if (name == NULL || password == NULL || domainname == NULL || groupname == NULL) if (name == NULL || password == NULL || domainname == NULL || groupname == NULL)
{ {
Debug("Sam.c - SmbAuthenticate - wrong password parameter\n"); Debug("Sam.c - SmbAuthenticate - wrong password parameter\n");
@ -156,14 +159,11 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna
if (strlen(groupname) > 1) if (strlen(groupname) > 1)
{ {
// DNS Name 255 chars + OU names are limited to 64 characters + cmdline 32 + 1
char requiremember[352];
// Truncate string if unsafe char // Truncate string if unsafe char
EnSafeStr(groupname, '\0'); EnSafeStr(groupname, '\0');
snprintf(requiremember, sizeof(requiremember), "--require-membership-of=%s\\%s", domainname, groupname); snprintf(requiremember, sizeof(requiremember), "--require-membership-of=%s\\%s", domainname, groupname);
proc_parameter[4] = requiremember; proc_parameter[4] = requiremember;
proc_parameter[5] = 0; proc_parameter[5] = 0;
} }