buglwIP - A Lightweight TCP/IP stack - Bugs: bug #63458, Sockopt hook cause socket leak.


You are not allowed to post comments on this tracker with your current authentication level.

bug #63458: Sockopt hook cause socket leak.

Submitter:  Masakazu <kneko715>
Submitted:  Fri 02 Dec 2022 10:39:40 AM UTC
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
lwIP version:  2.1.2

Fri 02 Dec 2022 10:39:40 AM UTC, original submission:  

After hooking lwip_setsockopt_impl or lwip_getsockopt_impl by using LWIP_HOOK_SOCKETS_SETSOCKOPT or LWIP_HOOK_SOCKETS_GETSOCKOPT, done_socket(sock) is not called so leak sock.

sockets.c : http://git.savannah.gnu.org/cgit/lwip.git/tree/src/api/sockets.c#n2937

> static int
> lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *optlen)
> {
>   int err = 0;
>   struct lwip_sock *sock = tryget_socket(s);
>   if (!sock) {
>     return EBADF;
>   }
>   if (LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, &err)) {
>     !!CALL done_socket(sock) here!!
>     return err;
>   }
> #endif

After hooked, should call done_socket(sock) before return.

Thank you.

Masakazu <kneko715>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by kneko715 (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.12