Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/wolfssh/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ static int FingerprintKey(const byte* pubKey, word32 pubKeySz, char* out)
ret = Base64_Encode_NoNl(digest, sizeof(digest), (byte*)fp, &fpSz);

if (ret == 0) {
if (fp[fpSz] == '=') {
fp[fpSz] = 0;
if (fpSz > 0 && fp[fpSz - 1] == '=') {
/* Remove trailing padding */
fp[fpSz - 1] = 0;
}

WSTRCAT(out, "SHA256:");
Expand Down
15 changes: 8 additions & 7 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4235,7 +4235,7 @@ static word32 AlgoListSz(const char* algoList)
return 0;

algoListSz = (word32)WSTRLEN(algoList);
if (algoList[algoListSz-1] == ',') {
if (algoListSz > 0 && algoList[algoListSz-1] == ',') {
--algoListSz;
}

Expand Down Expand Up @@ -8573,11 +8573,10 @@ static int DoUserAuthInfoRequest(WOLFSSH* ssh, byte* buf, word32 len,
if (ssh == NULL || buf == NULL || len == 0 || idx == NULL)
ret = WS_BAD_ARGUMENT;

if (ssh->ctx != NULL) {
heap = ssh->ctx->heap;
}

if (ret == WS_SUCCESS) {
if (ssh->ctx != NULL) {
heap = ssh->ctx->heap;
}
begin = *idx;
ret = GetStringAlloc(heap, (char**)&authName, NULL, buf, len, &begin);
}
Expand Down Expand Up @@ -8653,7 +8652,9 @@ static int DoUserAuthInfoRequest(WOLFSSH* ssh, byte* buf, word32 len,
ret = SendUserAuthKeyboardResponse(ssh);
}

ssh->authId = ID_USERAUTH_KEYBOARD;
if (ret == WS_SUCCESS) {
ssh->authId = ID_USERAUTH_KEYBOARD;
}

WLOG(WS_LOG_DEBUG, "Leaving DoUserAuthInfoRequest(), ret = %d", ret);

Expand Down Expand Up @@ -10948,11 +10949,11 @@ static int BundlePacket(WOLFSSH* ssh)

idx += paddingSz;

WMEMSET(output + idx, 0, macSz);
if (idx + macSz > ssh->outputBuffer.bufferSz) {
ret = WS_BUFFER_E;
}
else {
WMEMSET(output + idx, 0, macSz);
ret = CreateMac(ssh, ssh->outputBuffer.buffer +
ssh->packetStartIdx, ssh->outputBuffer.length -
ssh->packetStartIdx + paddingSz, output + idx);
Expand Down
2 changes: 1 addition & 1 deletion src/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,7 @@ int wolfSSH_ReadKey_file(const char* name,
out, outSz, outType, outTypeSz, *isPrivate, heap);
}

WFCLOSE(ssh->fs, file);
WFCLOSE(NULL, file);
WFREE(in, heap, DYNTYPE_FILE);

return ret;
Expand Down
Loading