mirror of https://github.com/wolfSSL/wolfssh.git
Fix memory management in serverKeyboardCallback for empty prompts
Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>pull/803/head
parent
63db9f162f
commit
c5c52eecb1
12
tests/auth.c
12
tests/auth.c
|
@ -280,7 +280,17 @@ static int serverUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
|
||||||
static int serverKeyboardCallback(WS_UserAuthData_Keyboard *kbAuth, void *ctx)
|
static int serverKeyboardCallback(WS_UserAuthData_Keyboard *kbAuth, void *ctx)
|
||||||
{
|
{
|
||||||
(void) ctx;
|
(void) ctx;
|
||||||
WMEMCPY(kbAuth, &promptData, sizeof(WS_UserAuthData_Keyboard));
|
/* Copy individual fields instead of the entire structure to avoid memory issues */
|
||||||
|
kbAuth->promptCount = promptData.promptCount;
|
||||||
|
kbAuth->promptName = promptData.promptName;
|
||||||
|
kbAuth->promptNameSz = promptData.promptNameSz;
|
||||||
|
kbAuth->promptInstruction = promptData.promptInstruction;
|
||||||
|
kbAuth->promptInstructionSz = promptData.promptInstructionSz;
|
||||||
|
kbAuth->promptLanguage = promptData.promptLanguage;
|
||||||
|
kbAuth->promptLanguageSz = promptData.promptLanguageSz;
|
||||||
|
kbAuth->prompts = promptData.prompts;
|
||||||
|
kbAuth->promptLengths = promptData.promptLengths;
|
||||||
|
kbAuth->promptEcho = promptData.promptEcho;
|
||||||
|
|
||||||
return WS_SUCCESS;
|
return WS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue