When we have less than blocksize data left we MUST (attempt to) read more
since we can't decrypt anything in that situation.
This commit is contained in:
parent
c4630d1ffb
commit
f216b36328
@ -267,7 +267,6 @@ libssh2_packet_read(LIBSSH2_SESSION * session)
|
|||||||
int numdecrypt;
|
int numdecrypt;
|
||||||
unsigned char block[MAX_BLOCKSIZE];
|
unsigned char block[MAX_BLOCKSIZE];
|
||||||
int blocksize;
|
int blocksize;
|
||||||
int minimum;
|
|
||||||
int encrypted = 1;
|
int encrypted = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -293,7 +292,6 @@ libssh2_packet_read(LIBSSH2_SESSION * session)
|
|||||||
blocksize = 5; /* not strictly true, but we can use 5 here to
|
blocksize = 5; /* not strictly true, but we can use 5 here to
|
||||||
make the checks below work fine still */
|
make the checks below work fine still */
|
||||||
}
|
}
|
||||||
minimum = p->total_num ? p->total_num - p->data_num : blocksize;
|
|
||||||
|
|
||||||
/* read/use a whole big chunk into a temporary area stored in
|
/* read/use a whole big chunk into a temporary area stored in
|
||||||
the LIBSSH2_SESSION struct. We will decrypt data from that
|
the LIBSSH2_SESSION struct. We will decrypt data from that
|
||||||
@ -308,8 +306,8 @@ libssh2_packet_read(LIBSSH2_SESSION * session)
|
|||||||
/* if remainbuf turns negative we have a bad internal error */
|
/* if remainbuf turns negative we have a bad internal error */
|
||||||
assert(remainbuf >= 0);
|
assert(remainbuf >= 0);
|
||||||
|
|
||||||
if (remainbuf < minimum) {
|
if (remainbuf < blocksize) {
|
||||||
/* If we have less than a minimum left, it is too
|
/* If we have less than a blocksize left, it is too
|
||||||
little data to deal with, read more */
|
little data to deal with, read more */
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user