diff --git a/examples/server/server.c b/examples/server/server.c index 8985fcd..e0bf1bd 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -161,7 +161,7 @@ static THREAD_RETURN WOLFSSH_THREAD server_worker(void* vArgs) WMEMCPY(scpBufferSend.name, "test.txt", sizeof("test.txt")); scpBufferSend.nameSz = WSTRLEN("test.txt"); scpBufferSend.buffer = fileTmp; - scpBufferSend.bufferSz = sizeof(fileTmp); + scpBufferSend.bufferSz = sizeof(fileBuffer); scpBufferSend.fileSz = sizeof(fileTmp); scpBufferSend.mode = 0x1A4; wolfSSH_SetScpSendCtx(threadCtx->ssh, (void*)&scpBufferSend); diff --git a/src/wolfscp.c b/src/wolfscp.c index de57595..6e396ef 100644 --- a/src/wolfscp.c +++ b/src/wolfscp.c @@ -1045,8 +1045,8 @@ static int ScpCheckForRename(WOLFSSH* ssh, int cmdSz) } #else /* allow placing file at base address ':/' */ - if (sz == 1 && buf[0] == WS_DELIM) { - idx--; + if (WSTRLEN(buf) == 1 && buf[0] == WS_DELIM) { + idx--; /* no delimiter at base */ } #endif if (idx > cmdSz || idx > sz) { @@ -2598,7 +2598,7 @@ int wsScpSendCallback(WOLFSSH* ssh, int state, const char* peerRequest, case WOLFSSH_SCP_SINGLE_FILE_REQUEST: if (sendBuffer->buffer == NULL) { - wolfSSH_SetScpErrorMsg(ssh, "no buffer to send"); + WLOG(WS_LOG_DEBUG, scpState, "no buffer to send"); ret = WS_SCP_ABORT; break; } @@ -2614,7 +2614,7 @@ int wsScpSendCallback(WOLFSSH* ssh, int state, const char* peerRequest, } if (WSTRLEN(fileName) != sendBuffer->nameSz || - WMEMCMP(sendBuffer->name, fileName, fileNameSz) != 0) { + WMEMCMP(sendBuffer->name, fileName, sendBuffer->nameSz) != 0) { wolfSSH_SetScpErrorMsg(ssh, "file name did not match"); ret = WS_SCP_ABORT; break; @@ -2672,7 +2672,7 @@ int wsScpSendCallback(WOLFSSH* ssh, int state, const char* peerRequest, break; default: - wolfSSH_SetScpErrorMsg(ssh, "bad state"); + WLOG(WS_LOG_DEBUG, scpState, "bad state"); ret = WS_SCP_ABORT; } (void)fileOffset;