Skip to content

Commit bf4032f

Browse files
committed
Fix handle mis-parse
This could lead to the server process accessing uninitialized data. In some deployment models this would be a vulnerability. However, the README specifically warns about avoiding such deployment models, so this patch is not going to be treated as a vulnerability fix.
1 parent 392a5b3 commit bf4032f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

parse.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ uint32_t sftp_parse_path(struct sftpjob *job, char **strp) {
9797
uint32_t sftp_parse_handle(struct sftpjob *job, struct handleid *id) {
9898
uint32_t len, rc;
9999

100-
if((rc = sftp_parse_uint32(job, &len)) != SSH_FX_OK || len != 8 ||
101-
(rc = sftp_parse_uint32(job, &id->id)) != SSH_FX_OK ||
100+
if((rc = sftp_parse_uint32(job, &len)) != SSH_FX_OK)
101+
return rc;
102+
if(len != 8)
103+
return SSH_FX_BAD_MESSAGE;
104+
if((rc = sftp_parse_uint32(job, &id->id)) != SSH_FX_OK ||
102105
(rc = sftp_parse_uint32(job, &id->tag) != SSH_FX_OK))
103106
return rc;
104107
return SSH_FX_OK;

0 commit comments

Comments
 (0)