Merge pull request #841 from LinuxJedi/agent-lock-fix

Fix overflow in PostLock / PostUnlock
pull/842/head
David Garske 2025-10-14 12:51:24 -07:00 committed by GitHub
commit 05d02892eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -366,6 +366,7 @@ static int PostSuccess(WOLFSSH_AGENT_CTX* agent)
}
/* Stub that has not yet been implemented */
static int PostLock(WOLFSSH_AGENT_CTX* agent,
const byte* passphrase, word32 passphraseSz)
{
@ -378,7 +379,7 @@ static int PostLock(WOLFSSH_AGENT_CTX* agent,
if (passphraseSz < ppSz)
ppSz = passphraseSz;
WMEMCPY(pp, passphrase, passphraseSz);
WMEMCPY(pp, passphrase, ppSz);
pp[ppSz] = 0;
WLOG(WS_LOG_AGENT, "Locking with passphrase '%s'", pp);
@ -386,6 +387,7 @@ static int PostLock(WOLFSSH_AGENT_CTX* agent,
}
/* Stub that has not yet been implemented */
static int PostUnlock(WOLFSSH_AGENT_CTX* agent,
const byte* passphrase, word32 passphraseSz)
{
@ -398,7 +400,7 @@ static int PostUnlock(WOLFSSH_AGENT_CTX* agent,
if (passphraseSz < ppSz)
ppSz = passphraseSz;
WMEMCPY(pp, passphrase, passphraseSz);
WMEMCPY(pp, passphrase, ppSz);
pp[ppSz] = 0;
WLOG(WS_LOG_AGENT, "Unlocking with passphrase '%s'", pp);