Skip to content
Merged
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
14 changes: 14 additions & 0 deletions src/wolfsftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2820,6 +2820,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
if (SFTP_CreateLongName(out) != WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Error creating long name for %s", out->fName);
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
Comment thread
ejohnstown marked this conversation as resolved.
return WS_FATAL_ERROR;
}

Expand Down Expand Up @@ -2889,13 +2890,15 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
>= (int)sizeof(r)) {
WLOG(WS_LOG_SFTP, "Path length too large");
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}
}
else {
if (out->fSz + 1 > (sizeof r)) {
WLOG(WS_LOG_SFTP, "Path length too large");
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}
WSTRNCPY(r, out->fName, sizeof(r));
Expand All @@ -2904,6 +2907,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
if (wolfSSH_RealPath(ssh->sftpDefaultPath, r, s, sizeof(s)) < 0) {
WLOG(WS_LOG_SFTP, "Error cleaning path to get attributes");
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

Expand All @@ -2930,6 +2934,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
if (SFTP_CreateLongName(out) != WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Error creating long name for %s", out->fName);
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

Expand Down Expand Up @@ -2987,12 +2992,14 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
>= (int)sizeof(r)) {
WLOG(WS_LOG_SFTP, "Path length too large");
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

if (wolfSSH_RealPath(ssh->sftpDefaultPath, r, s, sizeof(s)) < 0) {
WLOG(WS_LOG_SFTP, "Error cleaning path to get attributes");
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

Expand All @@ -3007,6 +3014,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
if (SFTP_CreateLongName(out) != WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Error creating long name for %s", out->fName);
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

Expand Down Expand Up @@ -3084,6 +3092,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
buf = (char*)WMALLOC(bufSz, out->heap, DYNTYPE_SFTP);
if (buf == NULL) {
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_MEMORY_E;
}

Expand All @@ -3105,6 +3114,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
if (SFTP_CreateLongName(out) != WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Error creating long name for %s", out->fName);
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

Expand Down Expand Up @@ -3217,11 +3227,13 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
>= (int)sizeof(r)) {
WLOG(WS_LOG_SFTP, "Path length too large");
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

if (wolfSSH_RealPath(ssh->sftpDefaultPath, r, s, sizeof(s)) < 0) {
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
WLOG(WS_LOG_SFTP, "Error cleaning path to get attributes");
return WS_FATAL_ERROR;
}
Expand All @@ -3237,6 +3249,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
if (SFTP_CreateLongName(out) != WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Error creating long name for %s", out->fName);
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}

Expand Down Expand Up @@ -3294,6 +3307,7 @@ static int wolfSSH_SFTPNAME_readdir(WOLFSSH* ssh, WDIR* dir, WS_SFTPNAME* out,
if (SFTP_CreateLongName(out) != WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Error creating long name for %s", out->fName);
WFREE(out->fName, out->heap, DYNTYPE_SFTP);
out->fName = NULL;
return WS_FATAL_ERROR;
}
return WS_SUCCESS;
Expand Down
Loading