diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-14 18:10:13 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-14 19:28:34 +0100 |
| commit | 872cf03f26c2801ae6c3008ce5fa0d7856f5f85d (patch) | |
| tree | 94809812b71ee286eb5b74c70e4d08fc4c8dc057 /lib/libc/string | |
| parent | ec769a83bde09c76bd6ad9ee7f391036dba5cd97 (diff) | |
libc: implement err/warn functions
Diffstat (limited to 'lib/libc/string')
| -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]; } |
