diff options
| author | caixf <[email protected]> | 2020-12-08 15:48:58 +0800 |
|---|---|---|
| committer | caixf <[email protected]> | 2020-12-08 15:48:58 +0800 |
| commit | 0f991c2e3e66fae0d0059d79ccc20f9bb0d824b4 (patch) | |
| tree | 096ca4136893263f0ff718ae50a2d43ea8e07a32 /components/net/sal_socket/src | |
| parent | 3f122bd790231ad097cc2346fa574a660eb294da (diff) | |
[sal] fix
Diffstat (limited to 'components/net/sal_socket/src')
| -rw-r--r-- | components/net/sal_socket/src/sal_socket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/components/net/sal_socket/src/sal_socket.c b/components/net/sal_socket/src/sal_socket.c index ec0519df02..1e05aded59 100644 --- a/components/net/sal_socket/src/sal_socket.c +++ b/components/net/sal_socket/src/sal_socket.c @@ -309,12 +309,13 @@ struct sal_socket *sal_get_socket(int socket) { struct sal_socket_table *st = &socket_table; + socket = socket - SAL_SOCKET_OFFSET; + if (socket < 0 || socket >= (int) st->max_socket) { return RT_NULL; } - socket = socket - SAL_SOCKET_OFFSET; /* check socket structure valid or not */ RT_ASSERT(st->sockets[socket]->magic == SAL_SOCKET_MAGIC); @@ -975,7 +976,7 @@ int sal_closesocket(int socket) /* clsoesocket operation not need to vaild network interface status */ /* valid the network interface socket opreation */ - SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, socket); + SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, closesocket); if (pf->skt_ops->closesocket((int) sock->user_data) == 0) { |
