Revert "sys/exceptions: Remove unnecessary exception number bounds check"
This reverts commit cdc875073c67b4858bace7d8f032e804500ccac5.
diff --git a/common/sys/exceptions.s2.c b/common/sys/exceptions.s2.c
index 8a4a7fcc..cbe68f8e 100644
--- a/common/sys/exceptions.s2.c
+++ b/common/sys/exceptions.s2.c
@@ -41,7 +41,10 @@ static const char *exception_names[] = {
void except(uint32_t exception, uint32_t error_code, uint32_t ebp, uint32_t eip) {
(void)ebp;
- panic(false, "%s exception at %x. Error code: %x", exception_names[exception], eip, error_code);
+ const char *exception_name = exception < SIZEOF_ARRAY(exception_names)
+ ? exception_names[exception]
+ : "Unknown";
+ panic(false, "%s exception at %x. Error code: %x", exception_name, eip, error_code);
}
#endif
