mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 16:35:06 +00:00
LibC: Fix OOB access in strerror() with invalid input
Calling strerror() with a negative number should not access below the error string array. Found by running GCC in UE. :^)
This commit is contained in:
parent
abe9cec612
commit
a65e7db533
1 changed files with 1 additions and 1 deletions
|
@ -372,7 +372,7 @@ int sys_nerr = EMAXERRNO;
|
|||
|
||||
char* strerror(int errnum)
|
||||
{
|
||||
if (errnum >= EMAXERRNO) {
|
||||
if (errnum < 0 || errnum >= EMAXERRNO) {
|
||||
printf("strerror() missing string for errnum=%d\n", errnum);
|
||||
return const_cast<char*>("Unknown error");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue