[sr-dev] git:master:d8257e3c: Merge pull request #2595 from theraphim/master
GitHub
noreply at github.com
Tue Jan 5 16:30:18 CET 2021
Module: kamailio
Branch: master
Commit: d8257e3c947c5619456dedcea51d28691a70fd84
URL: https://github.com/kamailio/kamailio/commit/d8257e3c947c5619456dedcea51d28691a70fd84
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: GitHub <noreply at github.com>
Date: 2021-01-05T16:30:11+01:00
Merge pull request #2595 from theraphim/master
Fix 2 issues that prevent auto_bind_ipv6 from happening on my setup
---
Modified: src/core/socket_info.c
---
Diff: https://github.com/kamailio/kamailio/commit/d8257e3c947c5619456dedcea51d28691a70fd84.diff
Patch: https://github.com/kamailio/kamailio/commit/d8257e3c947c5619456dedcea51d28691a70fd84.patch
---
diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index a46aba24ad..d55f506bcc 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1070,6 +1070,7 @@ static int nl_bound_sock(void)
req.g.rtgen_family = family;\
} while(0);
+#define NETLINK_BUFFER_SIZE 32768
static int get_flags(int family){
struct {
@@ -1079,12 +1080,12 @@ static int get_flags(int family){
int rtn = 0;
struct nlmsghdr* nlp;
struct ifinfomsg *ifi;
- char buf[8192];
+ char buf[NETLINK_BUFFER_SIZE];
char *p = buf;
int nll = 0;
int nl_sock = -1;
- fill_nl_req(req, RTM_GETLINK, AF_INET);
+ fill_nl_req(req, RTM_GETLINK, family);
if((nl_sock = nl_bound_sock()) < 0) return -1;
@@ -1095,6 +1096,10 @@ static int get_flags(int family){
}
while(1) {
+ if ((sizeof(buf) - nll) == 0) {
+ LM_ERR("netlink buffer overflow in get_flags");
+ goto error;
+ }
rtn = recv(nl_sock, p, sizeof(buf) - nll, 0);
nlp = (struct nlmsghdr *) p;
if(nlp->nlmsg_type == NLMSG_DONE){
@@ -1148,7 +1153,7 @@ static int build_iface_list(void)
struct nlmsghdr* nlp;
struct ifaddrmsg *ifi;
int rtl;
- char buf[8192];
+ char buf[NETLINK_BUFFER_SIZE];
char *p = buf;
int nll = 0;
struct rtattr * rtap;
@@ -1184,6 +1189,10 @@ static int build_iface_list(void)
nll = 0;
p = buf;
while(1) {
+ if ((sizeof(buf) - nll) == 0) {
+ LM_ERR("netlink buffer overflow in build_iface_list");
+ goto error;
+ }
rtn = recv(nl_sock, p, sizeof(buf) - nll, 0);
LM_DBG("received %d byles \n", rtn);
nlp = (struct nlmsghdr *) p;
More information about the sr-dev
mailing list