Module: kamailio
Branch: master
Commit: 462f9730eb55a3abbd50b9170eb6318eb43eb999
URL: 
https://github.com/kamailio/kamailio/commit/462f9730eb55a3abbd50b9170eb6318eb43eb999

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-02-06T08:07:46+01:00

core: socket info - use unsigned for current size in buffer for get flags

---

Modified: src/core/socket_info.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/462f9730eb55a3abbd50b9170eb6318eb43eb999.diff
Patch: 
https://github.com/kamailio/kamailio/commit/462f9730eb55a3abbd50b9170eb6318eb43eb999.patch

---

diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 24243fea153..4fd44fec2dc 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1439,7 +1439,7 @@ static int get_flags(int family)
        struct ifinfomsg *ifi;
        char buf[NETLINK_BUFFER_SIZE];
        char *p = buf;
-       int nll = 0;
+       unsigned int nll = 0;
        int nl_sock = -1;
 
        fill_nl_req(req, RTM_GETLINK, family);
@@ -1453,7 +1453,7 @@ static int get_flags(int family)
        }
 
        while(1) {
-               if((sizeof(buf) - nll) == 0) {
+               if(sizeof(buf) <= nll) {
                        LM_ERR("netlink buffer overflow in get_flags");
                        goto error;
                }

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to