Skip to content

Commit 5e77b6c

Browse files
committed
Check wolfSSL_write return value
1 parent 40b35a4 commit 5e77b6c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

wolfssl/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,17 @@ def write(self, data):
572572

573573
data = t2b(data)
574574

575-
return _lib.wolfSSL_write(self.native_object, data, len(data))
575+
ret = _lib.wolfSSL_write(
576+
self.native_object, data, len(data))
577+
if ret <= 0:
578+
err = _lib.wolfSSL_get_error(
579+
self.native_object, 0)
580+
if err == _SSL_ERROR_WANT_WRITE:
581+
raise SSLWantWriteError()
582+
else:
583+
raise SSLError(
584+
"wolfSSL_write error (%d)" % err)
585+
return ret
576586

577587
def send(self, data, flags=0):
578588
if flags != 0:

0 commit comments

Comments
 (0)