Skip to content

Commit ad059d7

Browse files
ejohnstownphilljj
authored andcommitted
echoserver: only continue the rekey drain on an empty read
wolfSSH_ChannelIdRead() returns a negative value for a real error, and the rekey arm treated that the same as a zero read. Restrict the continue to cnt_r == 0 so an error still ends the loop.
1 parent 59a1ef8 commit ad059d7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

examples/echoserver/echoserver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ static int ssh_worker(thread_ctx_t* threadCtx)
10141014
if (cnt_r <= 0) {
10151015
/* Nothing was buffered. Only an actual data
10161016
* report makes that a failure. */
1017-
if (rc == WS_REKEYING)
1017+
if (rc == WS_REKEYING && cnt_r == 0)
10181018
continue;
10191019
break;
10201020
}
@@ -1058,7 +1058,7 @@ static int ssh_worker(thread_ctx_t* threadCtx)
10581058
if (cnt_r <= 0) {
10591059
/* Nothing was buffered. Only an actual data
10601060
* report makes that a failure. */
1061-
if (rc == WS_REKEYING)
1061+
if (rc == WS_REKEYING && cnt_r == 0)
10621062
continue;
10631063
break;
10641064
}
@@ -1082,7 +1082,7 @@ static int ssh_worker(thread_ctx_t* threadCtx)
10821082
if (cnt_r <= 0) {
10831083
/* Nothing was buffered. Only an actual data
10841084
* report makes that a failure. */
1085-
if (rc == WS_REKEYING)
1085+
if (rc == WS_REKEYING && cnt_r == 0)
10861086
continue;
10871087
break;
10881088
}

0 commit comments

Comments
 (0)