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

format_user_id function error #349

Open
Patjwi opened this issue Jul 14, 2023 · 1 comment
Open

format_user_id function error #349

Patjwi opened this issue Jul 14, 2023 · 1 comment
Assignees

Comments

@Patjwi
Copy link

Patjwi commented Jul 14, 2023

There is a bug in the format_user_id function in the upf/pfcp.c.
This causes a segmentation fault error when running in debug mode. This problem started occurring from stable/1.6.

image

In my opinion, the code can be fixed by modifying it so that the s0 pointer variable is provided as a parameter to the format function in the first if statement. Please refer to stable/1.4.

@james-gogo
Copy link

I think it would be correct to change it to s0 for IMSI and s for IMEI.

u8 *
format_user_id (u8 * s0, va_list * args)
{
pfcp_user_id_t *v = va_arg (*args, pfcp_user_id_t *);
u8 *s = s0;

if (v->imsi_len > 0)
s = format (s0, "IMSI:%U,", format_tbcd, v->imsi, v->imsi_len); // s --> s0
if (v->imei_len > 0)
s = format (s, "IMEI:%U,", format_tbcd, v->imei, v->imei_len); // s0 --> s
if (v->msisdn_len > 0)
s = format (s, "MSISDN:%U,", format_tbcd, v->msisdn, v->msisdn_len);
if (vec_len (v->nai) > 0)
s = format (s, "NAI:%v,", v->nai);

if (s != s0)
_vec_len (s)--;

return s;
}

@mogaika mogaika self-assigned this Nov 17, 2023
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

No branches or pull requests

3 participants