diff --git a/src/logging.c b/src/logging.c index 2a8bfdc8d..d32ca43a7 100644 --- a/src/logging.c +++ b/src/logging.c @@ -336,6 +336,11 @@ err: * which should never happen unless even the DLGLOBAL category is missing. */ static inline int map_subsys(int subsys) { + /* Note: comparing signed and unsigned integers */ + + if (subsys > 0 && ((unsigned int)subsys) >= osmo_log_info->num_cat_user) + subsys = DLGLOBAL; + if (subsys < 0) subsys = subsys_lib2index(subsys); diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err index f4e9c1f43..4527d8351 100644 --- a/tests/logging/logging_test.err +++ b/tests/logging/logging_test.err @@ -4,4 +4,5 @@ DRLL You should see this DLGLOBAL You should see this on DLGLOBAL (a) DLGLOBAL You should see this on DLGLOBAL (b) DLGLOBAL You should see this on DLGLOBAL (c) +DLGLOBAL You should see this on DLGLOBAL (d) DLGLOBAL You should see this on DLGLOBAL (e)