diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 7be6a45..8ca32e7 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -1026,7 +1026,7 @@ THREAD_RETURN WOLFSSH_THREAD echoserver_test(void* args) WMEMCPY(ipaddr, &sock.ip_num, MAX_ADDRESS_SIZE); NU_Inet_NTOP(NU_FAMILY_IP, &ipaddr[0], buf, 16); - fprintf(stdout, "Listing on %s:%d\r\n", buf, port); + fprintf(stdout, "Listening on %s:%d\r\n", buf, port); } #endif diff --git a/examples/sftpclient/sftpclient.c b/examples/sftpclient/sftpclient.c index 97db63f..297014e 100644 --- a/examples/sftpclient/sftpclient.c +++ b/examples/sftpclient/sftpclient.c @@ -53,7 +53,8 @@ static void myStatusCb(WOLFSSH* sshIn, word32* bytes, char* name) { char buf[80]; word64 longBytes = ((word64)bytes[1] << 32) | bytes[0]; - WSNPRINTF(buf, sizeof(buf), "Processed %8ld\t bytes \r", longBytes); + WSNPRINTF(buf, sizeof(buf), "Processed %8llu\t bytes \r", + (unsigned long long)longBytes); WFPUTS(buf, fout); (void)name; (void)sshIn; @@ -1229,7 +1230,7 @@ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args) (word32)WSTRLEN(hanselPublicEcc), (byte*)userPublicKey, &userPublicKeySz); - strncpy((char*)userPublicKeyType, "ecdsa-sha2-nistp256", + WSTRNCPY((char*)userPublicKeyType, "ecdsa-sha2-nistp256", sizeof(userPublicKeyType)); userPrivateKey = hanselPrivateEcc; userPrivateKeySz = hanselPrivateEccSz; @@ -1240,7 +1241,7 @@ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args) (word32)WSTRLEN(hanselPublicRsa), (byte*)userPublicKey, &userPublicKeySz); - strncpy((char*)userPublicKeyType, "ssh-rsa", + WSTRNCPY((char*)userPublicKeyType, "ssh-rsa", sizeof(userPublicKeyType)); userPrivateKey = hanselPrivateRsa; userPrivateKeySz = hanselPrivateRsaSz; diff --git a/src/internal.c b/src/internal.c index 9426cba..91f701a 100644 --- a/src/internal.c +++ b/src/internal.c @@ -5091,8 +5091,8 @@ int DoReceive(WOLFSSH* ssh) ssh->curSz + LENGTH_SZ - peerBlockSz); } else { - WLOG(WS_LOG_INFO, - "Not trying to decrypt short message."); + /* Entire packet fit in one block, don't need + * to decrypt any more data this packet. */ } /* Verify the buffer is big enough for the data and mac. @@ -5149,8 +5149,8 @@ int DoReceive(WOLFSSH* ssh) ssh->error = ret; return WS_FATAL_ERROR; } - WLOG(WS_LOG_DEBUG, "PR3: peerMacSz = %u", ssh->peerMacSz); - ssh->inputBuffer.idx += ssh->peerMacSz; + WLOG(WS_LOG_DEBUG, "PR3: peerMacSz = %u", peerMacSz); + ssh->inputBuffer.idx += peerMacSz; break; default: diff --git a/src/ssh.c b/src/ssh.c index 96914a4..66e5bf2 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -1046,6 +1046,12 @@ int wolfSSH_SendIgnore(WOLFSSH* ssh, const byte* buf, word32 bufSz) } +int wolfSSH_SendDisconnect(WOLFSSH* ssh, word32 reason) +{ + return SendDisconnect(ssh, reason); +} + + void wolfSSH_SetUserAuth(WOLFSSH_CTX* ctx, WS_CallbackUserAuth cb) { if (ctx != NULL) { diff --git a/src/wolfscp.c b/src/wolfscp.c index 3b8ccd0..4ea2d4c 100644 --- a/src/wolfscp.c +++ b/src/wolfscp.c @@ -1259,7 +1259,7 @@ int ReceiveScpMessage(WOLFSSH* ssh) return sz; /* null-terminate request, replace newline */ - buf[sz-1] = '\0'; + buf[sz] = '\0'; switch (buf[0]) { case 'C': diff --git a/src/wolfsftp.c b/src/wolfsftp.c index 48ab7f4..19c0166 100644 --- a/src/wolfsftp.c +++ b/src/wolfsftp.c @@ -7287,7 +7287,7 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume, if (resume) { WMEMSET(&state->offset, 0, sizeof(OVERLAPPED)); state->offset.OffsetHigh = 0; - state->offset.Offset = (DWORD)state->pOfst; + state->offset.Offset = state->pOfst[0]; } #endif /* USE_WINDOWS_API */ state->rSz = 0; @@ -7342,7 +7342,7 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume, AddAssign64(state->pOfst, sz); #ifdef USE_WINDOWS_API state->offset.OffsetHigh = 0; - state->offset.Offset = (DWORD)state->pOfst; + state->offset.Offset = state->pOfst[0]; #endif /* USE_WINDOWS_API */ state->rSz -= sz; if (statusCb != NULL) { diff --git a/wolfssh/ssh.h b/wolfssh/ssh.h index 7cf9f28..0a75cb0 100644 --- a/wolfssh/ssh.h +++ b/wolfssh/ssh.h @@ -188,6 +188,7 @@ WOLFSSH_API int wolfSSH_stream_exit(WOLFSSH*, int); WOLFSSH_API int wolfSSH_extended_data_read(WOLFSSH*, byte*, word32); WOLFSSH_API int wolfSSH_TriggerKeyExchange(WOLFSSH*); WOLFSSH_API int wolfSSH_SendIgnore(WOLFSSH*, const byte*, word32); +WOLFSSH_API int wolfSSH_SendDisconnect(WOLFSSH*, word32); WOLFSSH_API int wolfSSH_global_request(WOLFSSH*, const unsigned char*, word32, int); WOLFSSH_API void wolfSSH_GetStats(WOLFSSH*,