Skip to content

Commit ede6f8e

Browse files
cast return and add test case
1 parent c95f040 commit ede6f8e

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

apps/wolfsshd/test/run_all_sshd_tests.sh

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ run_test() {
6060
run_test "sshd_exec_test.sh"
6161
run_test "sshd_term_size_test.sh"
6262
run_test "sshd_large_sftp_test.sh"
63+
run_test "sshd_bad_sftp_test.sh"
6364

6465
#Github actions needs resolved for these test cases
6566
#run_test "error_return.sh"
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
# sshd local test
4+
5+
PWD=`pwd`
6+
cd ../../..
7+
8+
TEST_SFTP_CLIENT="./examples/sftpclient/wolfsftp"
9+
USER=`whoami`
10+
PRIVATE_KEY="./keys/hansel-key-ecc.der"
11+
PUBLIC_KEY="./keys/hansel-key-ecc.pub"
12+
13+
if [ -z "$1" ] || [ -z "$2" ]; then
14+
echo "expecting host and port as arguments"
15+
echo "./sshd_exec_test.sh 127.0.0.1 22222"
16+
exit 1
17+
fi
18+
19+
mkdir test-$$
20+
mkdir test-$$/subfolder
21+
22+
echo "$TEST_SFTP_CLIENT -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -g -l configure -r `pwd`/test-$$/subfolder/ -h \"$1\" -p \"$2\""
23+
"$TEST_SFTP_CLIENT -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -g -l configure -r `pwd`/test-$$/subfolder/ -h $1 -p $2"
24+
25+
RESULT=$?
26+
if [ "$RESULT" = "0" ]; then
27+
echo "Expecting to fail transfer to folder"
28+
exit 1
29+
fi
30+
rm -rf test-$$
31+
32+
cd $PWD
33+
exit 0
34+

src/wolfsftp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ static int GetAndCleanPath(const char* defaultPath,
16951695
if (ret == 0 && WOLFSSH_SFTP_IS_DELIM(data[sz-1])) {
16961696
int strSz;
16971697

1698-
strSz = WSTRLEN(s);
1698+
strSz = (int)WSTRLEN(s);
16991699
if (strSz + 1 >= WOLFSSH_MAX_FILENAME) {
17001700
ret = WS_BUFFER_E;
17011701
}

0 commit comments

Comments
 (0)