diff options
author | dzwdz | 2022-10-04 13:59:21 +0200 |
---|---|---|
committer | dzwdz | 2022-10-04 13:59:21 +0200 |
commit | e83dca9817614d0dc77ce1e5dc13eed44b61eb2f (patch) | |
tree | 71bcb994d9cb4199cb002d39c06769f38be1ece2 /src/user/lib/string | |
parent | 710e9b2b5c16f74f66420c66d12455ad518d42c7 (diff) |
user/libc: camellia_open, takes cwd into account
Diffstat (limited to 'src/user/lib/string')
-rw-r--r-- | src/user/lib/string/strerror.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/user/lib/string/strerror.c b/src/user/lib/string/strerror.c index 1f5fc29..c838299 100644 --- a/src/user/lib/string/strerror.c +++ b/src/user/lib/string/strerror.c @@ -7,5 +7,7 @@ static const char *errstr[] = { }; char *strerror(int n) { - return (char*)(errstr[n] ? errstr[n] : "unknown error"); + if (0 <= n && n * sizeof(*errstr) < sizeof(errstr) && errstr[n]) + return (char*)errstr[n]; + return "unknown error"; } |