Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ims_registrar_scscf: fix uninitialized access of memory, minor refactors #3787

Merged
merged 4 commits into from Apr 29, 2024

Conversation

lynxis
Copy link
Contributor

@lynxis lynxis commented Mar 15, 2024

Pre-Submission Checklist

  • Commit message has the format required by CONTRIBUTING guide
  • Commits are split per component (core, individual modules, libs, utils, ...)
  • Each component has a single commit (if not, squash them into one commit)
  • No commits to README files for modules (changes must be done to docbook files
    in doc/ subfolder, the README file is autogenerated)

Type Of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)

Checklist:

  • PR should be backported to stable branches
  • Tested changes locally
  • Related to issue #XXXX (replace XXXX with an open issue number)

Description

A couple small changes to the ims_registrar_scscf which prevents kamailio from crashing on my system.
I would love to have more testing because I only did tests in my single user IMS setup.

The script "save" command can be used with different arguments:
2, 3 and 4.
But internally for all save() calls the exact same function is use, w_save().
When calling save("PRE_REG_SAR_REPLY","location"); as given by the examples,
kamailio will call w_save().
Because the command code will cast the function pointer, the w_save() function
is called with 2 uninitialized arguments *mode, *c_flags.
mode is unused, seems a legacy argument. c_flags is referenced resulting in a crash
if not null.

Use separate wrapper functions to handle different argument number.

Fixes: a627c9a ("ims_registrar_scscf: Extend save() with optional flag")
Rename function to match argument number.
Use assign_save_fixup3_async instead of the code copy
…arameter

The free_uint_fixup() freed the wrong parameter in the past.
@lynxis lynxis changed the title ims_registrar_scscf: fix memleaks, minor refactors ims_registrar_scscf: fix uninitialized access of memory, minor refactors Mar 15, 2024
Copy link

This PR is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.

@github-actions github-actions bot added the Stale label Apr 27, 2024
@henningw henningw removed the Stale label Apr 29, 2024
@henningw
Copy link
Contributor

Thanks for the PR, it will be merged in the next days if there are no more comments. Regarding further cleanups, it probably should also be investigated if we can replace the uint_fixup with some standard fixup from the core.

@miconda
Copy link
Member

miconda commented Apr 29, 2024

Looks ok for merging, imo.

@henningw henningw merged commit c3e6c1e into kamailio:master Apr 29, 2024
4 checks passed
@henningw
Copy link
Contributor

Thanks again, merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants