Fixed coverity warnings

This commit is contained in:
bennylp 2023-03-15 05:23:10 +07:00
parent 528afc8cea
commit a2abae0a40
3 changed files with 6 additions and 1 deletions

View File

@ -40,6 +40,7 @@
#endif
/* coverity[+kill] */
static void pj_scan_syntax_err(pj_scanner *scanner)
{
(*scanner->callback)(scanner);

View File

@ -536,7 +536,7 @@ static void on_request_complete(pj_stun_session *stun_sess,
eattr = (pj_stun_errcode_attr*)
pj_stun_msg_find_attr(response, PJ_STUN_ATTR_ERROR_CODE, 0);
if (eattr != NULL)
if (eattr != NULL && eattr->err_code)
err_code = eattr->err_code;
else
err_code = PJ_STUN_SC_SERVER_ERROR;

View File

@ -350,6 +350,10 @@ PJ_DEF(pj_status_t) pj_stun_authenticate_request(const pj_uint8_t *pkt,
pj_stun_create_key(pool, &p_info->auth_key,
(arealm?&arealm->value:NULL), &auser->value,
data_type, &password);
if (!p_info->auth_key.ptr) {
pj_assert(!"Null key");
return PJ_EBUG;
}
} else {
err_code = PJ_STUN_SC_UNAUTHORIZED;
goto on_auth_failed;