diff options
author | Damien George <damien@micropython.org> | 2023-08-09 13:17:04 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-08-09 13:22:32 +1000 |
commit | 20d3a6b1964705596d690182956f56b4f7678041 (patch) | |
tree | 548237e1ba98e51356e2503602d4019939818600 /extmod/modssl_mbedtls.c | |
parent | 218242d1de781124307be8720a7a9d2f373ca46b (diff) | |
download | micropython-20d3a6b1964705596d690182956f56b4f7678041.tar.gz micropython-20d3a6b1964705596d690182956f56b4f7678041.zip |
extmod/modssl_mbedtls: Reject ioctls that are not supported.
An SSL stream can only handle CLOSE and POLL ioctls. Other ones do not
make sense, or at least it doesn't make sense to pass the ioctl request
directly down to the underlying stream.
In particular MP_STREAM_GET_FILENO should not be passed to the underlying
stream because the SSL stream is not directly related to a file descriptor,
and the SSL stream must handle the polling itself.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/modssl_mbedtls.c')
-rw-r--r-- | extmod/modssl_mbedtls.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/extmod/modssl_mbedtls.c b/extmod/modssl_mbedtls.c index 6d78d7d1b3..8974ff65dd 100644 --- a/extmod/modssl_mbedtls.c +++ b/extmod/modssl_mbedtls.c @@ -514,6 +514,10 @@ STATIC mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, i } } } + } else { + // Unsupported ioctl. + *errcode = MP_EINVAL; + return MP_STREAM_ERROR; } // Pass all requests down to the underlying socket |