Skip to content

Commit 4ab1d21

Browse files
committed
connection check on wolfSSH_SFTP_STAT
1 parent 0e72885 commit 4ab1d21

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/wolfsftp.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6675,6 +6675,7 @@ static int SFTP_STAT(WOLFSSH* ssh, char* dir, WS_SFTP_FILEATRB* atr, byte type)
66756675
{
66766676
WS_SFTP_LSTAT_STATE* state = NULL;
66776677
int ret;
6678+
int ret_fatal = 0;
66786679
word32 localIdx;
66796680

66806681
WLOG(WS_LOG_SFTP, "Entering SFTP_STAT()");
@@ -6716,6 +6717,7 @@ static int SFTP_STAT(WOLFSSH* ssh, char* dir, WS_SFTP_FILEATRB* atr, byte type)
67166717
ssh->error == WS_WANT_WRITE)
67176718
return WS_FATAL_ERROR;
67186719
else {
6720+
ret_fatal = 1;
67196721
state->state = STATE_LSTAT_CLEANUP;
67206722
continue;
67216723
}
@@ -6734,6 +6736,7 @@ static int SFTP_STAT(WOLFSSH* ssh, char* dir, WS_SFTP_FILEATRB* atr, byte type)
67346736
return WS_FATAL_ERROR;
67356737
else {
67366738
state->state = STATE_LSTAT_CLEANUP;
6739+
ret_fatal = 1;
67376740
continue;
67386741
}
67396742
}
@@ -6815,7 +6818,10 @@ static int SFTP_STAT(WOLFSSH* ssh, char* dir, WS_SFTP_FILEATRB* atr, byte type)
68156818
WFREE(ssh->lstatState, ssh->ctx->heap, DYNTYPE_SFTP_STATE);
68166819
ssh->lstatState = NULL;
68176820
}
6818-
return WS_SUCCESS;
6821+
if(ret_fatal)
6822+
return WS_FATAL_ERROR;
6823+
else
6824+
return WS_SUCCESS;
68196825

68206826
default:
68216827
WLOG(WS_LOG_SFTP, "Bad SFTP LSTAT state, program error");

0 commit comments

Comments
 (0)