Skip to content

Commit df157e8

Browse files
adjust highwater check location to avoid masking return value
1 parent d3bd96f commit df157e8

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/internal.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9631,9 +9631,6 @@ static INLINE int Decrypt(WOLFSSH* ssh, byte* plain, const byte* input,
96319631

96329632
ssh->rxCount += sz;
96339633

9634-
if (ret == WS_SUCCESS)
9635-
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
9636-
96379634
return ret;
96389635
}
96399636

@@ -9902,9 +9899,6 @@ static INLINE int DecryptAead(WOLFSSH* ssh, byte* plain,
99029899
AeadIncrementExpIv(ssh->peerKeys.iv);
99039900
ssh->rxCount += sz;
99049901

9905-
if (ret == WS_SUCCESS)
9906-
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
9907-
99089902
return ret;
99099903
}
99109904
#endif /* WOLFSSH_NO_AEAD */
@@ -9940,6 +9934,14 @@ int DoReceive(WOLFSSH* ssh)
99409934
ssh->error = ret;
99419935
return WS_FATAL_ERROR;
99429936
}
9937+
9938+
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
9939+
if (ret != WS_SUCCESS) {
9940+
WLOG(WS_LOG_DEBUG, "PR: First HighwaterCheck fail");
9941+
ssh->error = ret;
9942+
ret = WS_FATAL_ERROR;
9943+
break;
9944+
}
99439945
}
99449946
NO_BREAK;
99459947

@@ -10024,6 +10026,14 @@ int DoReceive(WOLFSSH* ssh)
1002410026
}
1002510027
}
1002610028
ssh->processReplyState = PROCESS_PACKET;
10029+
10030+
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
10031+
if (ret != WS_SUCCESS) {
10032+
WLOG(WS_LOG_DEBUG, "PR: HighwaterCheck fail");
10033+
ssh->error = ret;
10034+
ret = WS_FATAL_ERROR;
10035+
break;
10036+
}
1002710037
NO_BREAK;
1002810038

1002910039
case PROCESS_PACKET:

0 commit comments

Comments
 (0)