Skip to content

oss-fuzz: Add fuzzer for auth response#4858

Open
arthurscchan wants to merge 1 commit intopjsip:masterfrom
arthurscchan:fuzz-auth
Open

oss-fuzz: Add fuzzer for auth response#4858
arthurscchan wants to merge 1 commit intopjsip:masterfrom
arthurscchan:fuzz-auth

Conversation

@arthurscchan
Copy link
Contributor

This PR creates a fuzzer for auth response handling.

@arthurscchan arthurscchan marked this pull request as ready for review March 14, 2026 00:00
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an OSS-Fuzz-style target to exercise PJSIP server-side authentication parsing/verification and challenge generation paths.

Changes:

  • Introduces a new fuzzer (fuzz-auth.c) that parses SIP requests and calls pjsip_auth_srv_verify() and pjsip_auth_srv_challenge().
  • Updates tests/fuzz/Makefile to build and clean the new fuzz-auth binary.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tests/fuzz/fuzz-auth.c New fuzzer harness for auth verify/challenge using parsed SIP messages.
tests/fuzz/Makefile Adds fuzz-auth to compile/link and clean targets.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +107 to +109
/* Test verification */
pjsip_auth_srv_verify(&auth_srv, &rdata, NULL);
}
Comment on lines +118 to +126
/* Setup minimal rdata */
pj_bzero(&rdata, sizeof(rdata));
rdata.msg_info.msg = msg;
rdata.tp_info.pool = pool;

/* Create 401 response */
status = pjsip_endpt_create_response(endpt, &rdata, 401, NULL, &tdata);
if (status != PJ_SUCCESS || !tdata)
return;
Comment on lines +39 to +47
static pj_status_t lookup_cred(pj_pool_t *pool, const pj_str_t *realm,
const pj_str_t *acc_name, pjsip_cred_info *cred)
{
pj_bzero(cred, sizeof(*cred));
cred->realm = *realm;
cred->username = *acc_name;
cred->data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
cred->data = pj_str("secret");
return PJ_SUCCESS;
Comment on lines +58 to +68
if (size < 10)
return NULL;

/* Copy to null-terminated buffer */
msg_buf = (char*)pj_pool_alloc(pool, size + 1);
pj_memcpy(msg_buf, data, size);
msg_buf[size] = '\0';

/* Parse SIP message */
pj_list_init(&err_list);
msg = pjsip_parse_msg(pool, msg_buf, size, &err_list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants