Module: kamailio
Branch: master
Commit: 7e08fc8d2b74657d6e6171effbab2770482d693e
URL:
https://github.com/kamailio/kamailio/commit/7e08fc8d2b74657d6e6171effbab277…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-05-29T13:29:36+02:00
stun: catch udp ping 0000 when trying to parse stun headers
- avoid useless debug message
- info message made debug if the size of received packet is too small
for a stun header
---
Modified: src/modules/stun/kam_stun.c
---
Diff:
https://github.com/kamailio/kamailio/commit/7e08fc8d2b74657d6e6171effbab277…
Patch:
https://github.com/kamailio/kamailio/commit/7e08fc8d2b74657d6e6171effbab277…
---
diff --git a/src/modules/stun/kam_stun.c b/src/modules/stun/kam_stun.c
index 350317b0e7..62bd368589 100644
--- a/src/modules/stun/kam_stun.c
+++ b/src/modules/stun/kam_stun.c
@@ -165,8 +165,12 @@ static int stun_parse_header(struct stun_msg* req, USHORT_T*
error_code)
{
if (sizeof(req->hdr) > req->msg.buf.len) {
+ if(req->msg.buf.len==4 && *((int*)req->msg.buf.s)==0) {
+ /* likely the UDP ping 0000 */
+ return FATAL_ERROR;
+ }
/* the received message does not contain whole header */
- LOG(L_INFO, "INFO: stun_parse_header: incomplete header of STUN message\n");
+ LM_DBG("incomplete header of STUN message\n");
/* Any better solution? IMHO it's not possible to send error response
* because the transaction ID is not available.
*/