Skip to content

Fix use-of-uninitialized-value in pjsip_auth_clt_init_req#4855

Merged
sauwming merged 2 commits intomasterfrom
copilot/fix-use-of-uninitialized-value
Mar 13, 2026
Merged

Fix use-of-uninitialized-value in pjsip_auth_clt_init_req#4855
sauwming merged 2 commits intomasterfrom
copilot/fix-use-of-uninitialized-value

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

Reported by OSS Fuzz:

MemorySanitizer reported a use-of-uninitialized-value in pjsip_auth_clt_init_req (sip_auth_client.c:1459) when reading sess->pref.initial_auth. The pref field (pjsip_auth_clt_pref) was never initialized in pjsip_auth_clt_init, so any call to pjsip_auth_clt_init_req without a prior pjsip_auth_clt_set_prefs reads garbage memory.

Description

Zero-initialize sess->pref in pjsip_auth_clt_init:

// pjsip/src/pjsip/sip_auth_client.c
sess->pool = pool;
sess->endpt = endpt;
sess->cred_cnt = 0;
sess->cred_info = NULL;
pj_list_init(&sess->cached_auth);
pj_bzero(&sess->pref, sizeof(sess->pref));  /* added */

This sets initial_auth to PJ_FALSE and algorithm to an empty pj_str_t — the correct defaults matching the documented behavior.

Motivation and Context

MSan trace from fuzzer (fuzz-sip.c):

==248==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 in pjsip_auth_clt_init_req sip_auth_client.c:1459
    #1 in do_test_auth_client fuzz-sip.c:280

pjsip_auth_clt_init initializes every other field in pjsip_auth_clt_sess explicitly but omitted pref.

How Has This Been Tested?

Built with no errors or warnings (make -j3).

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the CODING STYLE of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…alize sess->pref in pjsip_auth_clt_init

Co-authored-by: sauwming <17044930+sauwming@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix use of uninitialized value in SIP authentication client Fix use-of-uninitialized-value in pjsip_auth_clt_init_req Mar 13, 2026
Copilot AI requested a review from sauwming March 13, 2026 08:25
@sauwming sauwming marked this pull request as ready for review March 13, 2026 08:26
@sauwming sauwming merged commit 5c997b5 into master Mar 13, 2026
48 of 50 checks passed
@sauwming sauwming deleted the copilot/fix-use-of-uninitialized-value branch March 13, 2026 08:31
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