[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:
Sukchan Lee
2024-12-24 17:14:50 +09:00
parent 4016293214
commit 08b9e7c55f

View File

@@ -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)