mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-01 20:44:06 +00:00
[DBI] Fix crash in ogs_dbi_auth_info due to invalid SUPI (#3635)
Added checks to validate the SUPI ID in the ogs_dbi_auth_info function before calling ogs_assert. This prevents a crash when the SUPI ID is malformed, such as when it does not contain a hyphen. The fix ensures that invalid SUPI values are logged and handled gracefully, avoiding assertion failures and crashes in the UDR.
This commit is contained in:
@@ -39,9 +39,16 @@ int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
|
||||
ogs_assert(auth_info);
|
||||
|
||||
supi_type = ogs_id_get_type(supi);
|
||||
ogs_assert(supi_type);
|
||||
if (!supi_type) {
|
||||
ogs_error("Invalid supi=%s", supi);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
supi_id = ogs_id_get_value(supi);
|
||||
ogs_assert(supi_id);
|
||||
if (!supi_id) {
|
||||
ogs_error("Invalid supi=%s", supi);
|
||||
ogs_free(supi_type);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
|
||||
#if MONGOC_CHECK_VERSION(1, 5, 0)
|
||||
|
||||
Reference in New Issue
Block a user