Bug 1338696: Don't deref null when nr_stun_message_create2 fails. r?drno
MozReview-Commit-ID: 6yo1NtElboR
--- a/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/stun/stun_server_ctx.c
@@ -334,20 +334,20 @@ int nr_stun_server_process_request(nr_st
nr_stun_form_error_response(req, res, error, "ICE Failure");
ABORT(R_ALREADY);
}
}
_status=0;
abort:
- if (NR_STUN_GET_TYPE_CLASS(req->header.type) == NR_CLASS_INDICATION)
+ if (!res)
goto skip_response;
- if (!res)
+ if (NR_STUN_GET_TYPE_CLASS(req->header.type) == NR_CLASS_INDICATION)
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))) {