Bug 1310305: skip responding when failed to parse STUN message. r=mjf draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Fri, 14 Oct 2016 12:59:22 -0700
changeset 425498 c26e9826ee0f8a677acf22ccaeecb31d9cecce50
parent 425306 cb2dd5a34dd7b374500fedd72fe19df13c9a7a4d
child 533928 bb537d2712bc33c90d0a247bc0edb735198cc659
push id32432
push userdrno@ohlmeier.org
push dateFri, 14 Oct 2016 19:59:43 +0000
reviewersmjf
bugs1310305
milestone52.0a1
Bug 1310305: skip responding when failed to parse STUN message. r=mjf MozReview-Commit-ID: D9Ox0nt81bF
media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c
--- a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c
@@ -337,16 +337,19 @@ int nr_stun_server_process_request(nr_st
         }
     }
 
     _status=0;
   abort:
     if (NR_STUN_GET_TYPE_CLASS(req->header.type) == NR_CLASS_INDICATION)
         goto skip_response;
 
+    if (!res)
+        goto skip_response;
+
     /* Now respond */
 
     if (_status != 0 && ! nr_stun_message_has_attribute(res, NR_STUN_ATTR_ERROR_CODE, 0))
          nr_stun_form_error_response(req, res, 500, "Failed to specify error");
 
     if ((r=nr_stun_server_send_response(ctx, sock, peer_addr, res, clnt))) {
         r_log(NR_LOG_STUN,LOG_ERR,"STUN-SERVER(label=%s): Failed sending response (my_addr=%s,peer_addr=%s)",ctx->label,ctx->my_addr.as_string,peer_addr->as_string);
         _status = R_FAILED;