Skip to content

fix(sbi/consumer): nil-check JsonData on UEContextTransfer 200 response#214

Merged
Alonza0314 merged 2 commits into
free5gc:mainfrom
SAY-5:say5/uectx-transfer-nil-jsondata-1045
Jun 10, 2026
Merged

fix(sbi/consumer): nil-check JsonData on UEContextTransfer 200 response#214
Alonza0314 merged 2 commits into
free5gc:mainfrom
SAY-5:say5/uectx-transfer-nil-jsondata-1045

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 2, 2026

Copy link
Copy Markdown
Contributor

Fixes free5gc/free5gc#1045.

UEContextTransferRequest indexed res.UeContextTransferResponse200.JsonData and immediately dereferenced it for the debug log, but JsonData is *UeContextTransferRspData,omitempty in the OpenAPI model. A source AMF returning a syntactically-valid 200 OK with the jsonData part absent, picked application/json over multipart/related, or sent an empty body, reached here with the pointer nil and the deref panicked the target AMF during cross-AMF UE mobility / 5G-GUTI re-registration.

Guard the deref and surface a clear UeContextTransfer 200 missing JsonData error so the caller can fall through to the foreign-GUAMI handling path instead of crashing.

@SAY-5 SAY-5 changed the title UEContextTransferRequest: nil-check JsonData on 200 response fix(sbi/consumer): nil-check JsonData on UEContextTransfer 200 response May 5, 2026
@SAY-5 SAY-5 closed this May 5, 2026
@SAY-5 SAY-5 reopened this May 5, 2026
@SAY-5

SAY-5 commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

Updated PR title to match Conventional Commits format.

@SAY-5 SAY-5 force-pushed the say5/uectx-transfer-nil-jsondata-1045 branch from f368456 to f3574ba Compare May 5, 2026 21:30
@SAY-5

SAY-5 commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

Amended commit message to match Conventional Commits format.

@d11nn

d11nn commented May 6, 2026

Copy link
Copy Markdown

@chchen7 @wiwi878 PTAL

@SAY-5

SAY-5 commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

Done, trimmed verbose comments and moved context to the PR description. Thanks @roundspring2003!

@SAY-5 SAY-5 force-pushed the say5/uectx-transfer-nil-jsondata-1045 branch from 1d9f898 to f57d41c Compare May 6, 2026 21:34
@SAY-5

SAY-5 commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

Squashed commits to fix Conventional Commits check.

@roundspring2003

Copy link
Copy Markdown
Contributor

@SAY-5 plz help to fix the conflict

@SAY-5 SAY-5 force-pushed the say5/uectx-transfer-nil-jsondata-1045 branch from f57d41c to 8dfd855 Compare May 19, 2026 20:12
@SAY-5

SAY-5 commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

The branch currently shows as mergeable against main with all checks green, so there is no conflict to resolve right now. Let me know if anything else is needed.

ueContextTransferRspData = res.UeContextTransferResponse200.JsonData
if ueContextTransferRspData == nil {
logger.ConsumerLog.Warnln("UeContextTransfer 200 response missing JsonData")
err = openapi.ReportError("UeContextTransfer 200 missing JsonData")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @SAY-5 ,

I think it will be better to update the problem detail before the error return after we get in the nil error.

@SAY-5 SAY-5 force-pushed the say5/uectx-transfer-nil-jsondata-1045 branch from 8dfd855 to 3326301 Compare May 31, 2026 02:35
@SAY-5

SAY-5 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Set problemDetails before the missing-JsonData return so callers see a system-failure detail instead of nil (4aeb12b).

@SAY-5 SAY-5 force-pushed the say5/uectx-transfer-nil-jsondata-1045 branch from 4aeb12b to 7cc80e1 Compare June 2, 2026 20:37
@Alonza0314

Copy link
Copy Markdown
Member

Hi @SAY-5 ,
Could you help rebase this to the latest main branch commit? We’ve updated some Go module packages, so rebasing will make it easier for us to run the integration tests.
Thanks!

SAY-5 added 2 commits June 9, 2026 10:28
Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
…nData

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@d11nn d11nn force-pushed the say5/uectx-transfer-nil-jsondata-1045 branch from 7cc80e1 to 8050843 Compare June 9, 2026 10:29
@d11nn

d11nn commented Jun 9, 2026

Copy link
Copy Markdown

@Alonza0314 LGTM, I've rebased this branch to the latest main branch and passed in IT System.

@Alonza0314 Alonza0314 merged commit 23d845b into free5gc:main Jun 10, 2026
3 checks passed
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.

[Bugs] AMF UEContextTransfer consumer JsonData nil dereference (cross-AMF mobility)

4 participants