diff options
| author | Bernard Xiong <[email protected]> | 2020-12-09 15:19:45 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-09 15:19:45 +0800 |
| commit | 3123e626d555f46af51c6830c1e03c33568e2bd7 (patch) | |
| tree | a587f6e7148b379124003f6d8be05c981230dadc /components | |
| parent | 4f7cff88d08f0a2de87573a577dcd25b6e7f5544 (diff) | |
| parent | 0f991c2e3e66fae0d0059d79ccc20f9bb0d824b4 (diff) | |
Merge pull request #4138 from cc-caixf/master
[sal] fix
Diffstat (limited to 'components')
| -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) { |
