Skip to content

Commit 9e8b402

Browse files
committed
Fix overflow in PostLock / PostUnlock
1 parent 50aa10d commit 9e8b402

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/agent.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ static int PostSuccess(WOLFSSH_AGENT_CTX* agent)
366366
}
367367

368368

369+
/* Stub that has not yet been implemented */
369370
static int PostLock(WOLFSSH_AGENT_CTX* agent,
370371
const byte* passphrase, word32 passphraseSz)
371372
{
@@ -378,14 +379,15 @@ static int PostLock(WOLFSSH_AGENT_CTX* agent,
378379
if (passphraseSz < ppSz)
379380
ppSz = passphraseSz;
380381

381-
WMEMCPY(pp, passphrase, passphraseSz);
382+
WMEMCPY(pp, passphrase, ppSz);
382383
pp[ppSz] = 0;
383384
WLOG(WS_LOG_AGENT, "Locking with passphrase '%s'", pp);
384385

385386
return WS_SUCCESS;
386387
}
387388

388389

390+
/* Stub that has not yet been implemented */
389391
static int PostUnlock(WOLFSSH_AGENT_CTX* agent,
390392
const byte* passphrase, word32 passphraseSz)
391393
{
@@ -398,7 +400,7 @@ static int PostUnlock(WOLFSSH_AGENT_CTX* agent,
398400
if (passphraseSz < ppSz)
399401
ppSz = passphraseSz;
400402

401-
WMEMCPY(pp, passphrase, passphraseSz);
403+
WMEMCPY(pp, passphrase, ppSz);
402404
pp[ppSz] = 0;
403405
WLOG(WS_LOG_AGENT, "Unlocking with passphrase '%s'", pp);
404406

0 commit comments

Comments
 (0)