mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
LibC: Let strerror_r
fail if errnum
< 0
This commit is contained in:
parent
90e229c9b5
commit
33c3c32a38
1 changed files with 1 additions and 1 deletions
|
@ -357,7 +357,7 @@ int sys_nerr = EMAXERRNO;
|
||||||
int strerror_r(int errnum, char* buf, size_t buflen)
|
int strerror_r(int errnum, char* buf, size_t buflen)
|
||||||
{
|
{
|
||||||
auto saved_errno = errno;
|
auto saved_errno = errno;
|
||||||
if (errnum >= EMAXERRNO) {
|
if (errnum < 0 || errnum >= EMAXERRNO) {
|
||||||
auto rc = strlcpy(buf, "unknown error", buflen);
|
auto rc = strlcpy(buf, "unknown error", buflen);
|
||||||
if (rc >= buflen)
|
if (rc >= buflen)
|
||||||
dbgln("strerror_r(): Invalid error number '{}' specified and the output buffer is too small.", errnum);
|
dbgln("strerror_r(): Invalid error number '{}' specified and the output buffer is too small.", errnum);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue