diff options
Diffstat (limited to 'lib/libc/string/strerror.c')
| -rw-r--r-- | lib/libc/string/strerror.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index c0a73146..2d3ea611 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -104,6 +104,12 @@ char *strerror(int errnum) [EKEYREJECTED] = "Key was rejected by service", }; + if (errnum < 0 || (size_t)errnum >= sizeof(table) / sizeof(table[0]) || + !table[errnum]) { + errno = EINVAL; + return NULL; + } + return table[errnum]; } |
