Skip to content

Commit 1cc4418

Browse files
adjust highwater check location to avoid masking return value
1 parent e0a1bdd commit 1cc4418

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src/internal.c

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

96629662
ssh->rxCount += sz;
96639663

9664-
if (ret == WS_SUCCESS)
9665-
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
9666-
96679664
return ret;
96689665
}
96699666

@@ -9932,9 +9929,6 @@ static INLINE int DecryptAead(WOLFSSH* ssh, byte* plain,
99329929
AeadIncrementExpIv(ssh->peerKeys.iv);
99339930
ssh->rxCount += sz;
99349931

9935-
if (ret == WS_SUCCESS)
9936-
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
9937-
99389932
return ret;
99399933
}
99409934
#endif /* WOLFSSH_NO_AEAD */
@@ -9970,6 +9964,14 @@ int DoReceive(WOLFSSH* ssh)
99709964
ssh->error = ret;
99719965
return WS_FATAL_ERROR;
99729966
}
9967+
9968+
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
9969+
if (ret != WS_SUCCESS) {
9970+
WLOG(WS_LOG_DEBUG, "PR: First HighwaterCheck fail");
9971+
ssh->error = ret;
9972+
ret = WS_FATAL_ERROR;
9973+
break;
9974+
}
99739975
}
99749976
NO_BREAK;
99759977

@@ -10054,6 +10056,14 @@ int DoReceive(WOLFSSH* ssh)
1005410056
}
1005510057
}
1005610058
ssh->processReplyState = PROCESS_PACKET;
10059+
10060+
ret = HighwaterCheck(ssh, WOLFSSH_HWSIDE_RECEIVE);
10061+
if (ret != WS_SUCCESS) {
10062+
WLOG(WS_LOG_DEBUG, "PR: HighwaterCheck fail");
10063+
ssh->error = ret;
10064+
ret = WS_FATAL_ERROR;
10065+
break;
10066+
}
1005710067
NO_BREAK;
1005810068

1005910069
case PROCESS_PACKET:

0 commit comments

Comments
 (0)