-
Notifications
You must be signed in to change notification settings - Fork 928
Closed
Labels
Description
In function wolfSSL_read_internal, the ret variable can be overwritten by return value of NotifyWriteSide. So this error is ignored.
ret = ReceiveData(ssl, (byte*)data, sz, peek);
#ifdef HAVE_WRITE_DUP
if (ssl->dupWrite) {
if (ssl->error != 0 && ssl->error != WANT_READ
#ifdef WOLFSSL_ASYNC_CRYPT
&& ssl->error != WC_PENDING_E
#endif
) {
int notifyErr;
WOLFSSL_MSG("Notifying write side of fatal read error");
notifyErr = NotifyWriteSide(ssl, ssl->error);
if (notifyErr < 0) {
ret = ssl->error = notifyErr;
}
}
}
#endifEven the error is correctly received, in the end, the original error code does not held at:
if (ret < 0)
return WOLFSSL_FATAL_ERROR;It means all errors become a fatal error, which makes it hard to locate where is the problem. Shall we just keep error codes from ReceiveData or other APIs since they are defined errors from the manual?
Reactions are currently unavailable