-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented WOLFSSH_FTP_FSETSTAT #551
Implemented WOLFSSH_FTP_FSETSTAT #551
Conversation
Can one of the admins verify this patch? |
3e4ac58
to
3d6dfb3
Compare
ok to test |
WLOG(WS_LOG_SFTP, "Receiving WOLFSSH_FTP_FSETSTAT"); | ||
|
||
/* get file handle */ | ||
ato32(data + idx, &sz); idx += UINT32_SZ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can maxSz be less than 4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you're referring to the line below the one you've commented on.
maxSz
is a parameter of the function, and it's basically the size of the buffer, as far as I can tell. It's the same kind of code that is used throughout the wolfsftp.c
file and, indeed, the code I suppose you're referring to has been copied and pasted from other functions that need to get the file handle, which predate this PR, like wolfSSH_SFTP_RecvClose
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line I commented is pulling 4 bytes of data from the buffer.
If the maxSz is guaranteed to be more than 4 bytes, then you don't need a check to whether the buffer is big enough. Otherwise a check is needed to ensure there are 4 bytes to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand now. If that were an issue, then it would be an issue also in wolfSSH_SFTP_RecvClose and all other functions that do the same thing. I didn't delve into the code that deep, I just assumed that if it's correct elsewhere, then it's correct there, given that the way it gets there is the same as for all the other functions.
Some additional sanity checks have now been added in to wolfSSH master. |
I added in a sanity check
Added support for the SSH_FXP_FSETSTAT packet type.