Fix potential index out of bounds

This commit is contained in:
Johan Mattsson authored and Jon Shallow committed 2023-07-17 09:43:07 +01:00
1 parent 7a5d13acec
commit 4dc295f7e9
1 file changed
+1 -1
+1 -1
View File
@@ -1220,7 +1220,7 @@ coap_log_impl(coap_log_t level, const char *format, ...) {
if (len)
fprintf(log_fd, "%.*s ", (int)len, timebuf);
if (level > sizeof(loglevels)/sizeof(loglevels[0])) {
if (level >= sizeof(loglevels)/sizeof(loglevels[0])) {
fprintf(log_fd, "%4d ", level);
} else {
fprintf(log_fd, "%s ", loglevels[level]);