Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Matt Johnston
dropbear
Commits
34f9b2a8
Commit
34f9b2a8
authored
Mar 20, 2013
by
Matt Johnston
Browse files
Fix "-m none" case where an entire packet fits in a block and can be
read by read_packet_init()
parent
d37dcc63
Changes
1
Hide whitespace changes
Inline
Side-by-side
packet.c
View file @
34f9b2a8
...
...
@@ -133,22 +133,29 @@ void read_packet() {
/* Attempt to read the remainder of the packet, note that there
* mightn't be any available (EAGAIN) */
maxlen
=
ses
.
readbuf
->
len
-
ses
.
readbuf
->
pos
;
len
=
read
(
ses
.
sock_in
,
buf_getptr
(
ses
.
readbuf
,
maxlen
),
maxlen
);
if
(
maxlen
==
0
)
{
/* Occurs when the packet is only a single block long and has all
* been read in read_packet_init(). Usually means that MAC is disabled
*/
len
=
0
;
}
else
{
len
=
read
(
ses
.
sock_in
,
buf_getptr
(
ses
.
readbuf
,
maxlen
),
maxlen
);
if
(
len
==
0
)
{
ses
.
remoteclosed
();
}
if
(
len
==
0
)
{
ses
.
remoteclosed
();
}
if
(
len
<
0
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
{
TRACE
((
"leave read_packet: EINTR or EAGAIN"
))
return
;
}
else
{
dropbear_exit
(
"Error reading: %s"
,
strerror
(
errno
));
if
(
len
<
0
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
{
TRACE
((
"leave read_packet: EINTR or EAGAIN"
))
return
;
}
else
{
dropbear_exit
(
"Error reading: %s"
,
strerror
(
errno
));
}
}
}
buf_incrpos
(
ses
.
readbuf
,
len
);
buf_incrpos
(
ses
.
readbuf
,
len
);
}
if
((
unsigned
int
)
len
==
maxlen
)
{
/* The whole packet has been read */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment