Skip to content

Commit

Permalink
stun: catch udp ping 0000 when trying to parse stun headers
Browse files Browse the repository at this point in the history
- avoid useless debug message
- info message made debug if the size of received packet is too small
for a stun header

(cherry picked from commit 7e08fc8)
  • Loading branch information
miconda committed May 31, 2018
1 parent 7e763c7 commit 7d6dddf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/modules/stun/kam_stun.c
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 7d6dddf

Please sign in to comment.