[sr-dev] git:master:55575264: core: use parentesis to surround condtion on raw_ipip header size

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 20 16:57:12 CEST 2018


Module: kamailio
Branch: master
Commit: 55575264332e07611c269873c9ce0b5a63c35454
URL: https://github.com/kamailio/kamailio/commit/55575264332e07611c269873c9ce0b5a63c35454

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-09-20T16:45:48+02:00

core: use parentesis to surround condtion on raw_ipip header size

---

Modified: src/core/raw_sock.c

---

Diff:  https://github.com/kamailio/kamailio/commit/55575264332e07611c269873c9ce0b5a63c35454.diff
Patch: https://github.com/kamailio/kamailio/commit/55575264332e07611c269873c9ce0b5a63c35454.patch

---

diff --git a/src/core/raw_sock.c b/src/core/raw_sock.c
index 9dd65d2340..6b9e3f9f90 100644
--- a/src/core/raw_sock.c
+++ b/src/core/raw_sock.c
@@ -314,13 +314,14 @@ int raw_udp4_recv(int rsock, char** buf, int len, union sockaddr_union* from,
 	if (unlikely(n<0)) goto error;
 
 	end=*buf+n;
-	if (unlikely(n<((sizeof(struct ip) * raw_ipip ? 2 : 1)+sizeof(struct udphdr)))) {
+	if (unlikely(n<((sizeof(struct ip) * (raw_ipip ? 2 : 1))+sizeof(struct udphdr)))) {
 		n=-3;
 		goto error;
 	}
 
-	if(raw_ipip)
-        	*buf = *buf + sizeof(struct ip);
+	if(raw_ipip) {
+		*buf = *buf + sizeof(struct ip);
+	}
 
 	/* FIXME: if initial buffer is aligned, one could skip the memcpy
 	   and directly cast ip and udphdr pointer to the memory */




More information about the sr-dev mailing list