summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/logging.c4
-rw-r--r--tests/logging/logging_test.err1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/logging.c b/src/logging.c
index 71025432..2a8bfdc8 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -339,9 +339,11 @@ static inline int map_subsys(int subsys)
if (subsys < 0)
subsys = subsys_lib2index(subsys);
- if (subsys > osmo_log_info->num_cat)
+ if (subsys < 0 || subsys >= osmo_log_info->num_cat)
subsys = subsys_lib2index(DLGLOBAL);
+ OSMO_ASSERT(!(subsys < 0 || subsys >= osmo_log_info->num_cat));
+
return subsys;
}
diff --git a/tests/logging/logging_test.err b/tests/logging/logging_test.err
index cc21b32d..273a852b 100644
--- a/tests/logging/logging_test.err
+++ b/tests/logging/logging_test.err
@@ -3,3 +3,4 @@ DCC You should see this
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)