mirror of
https://git.musl-libc.org/git/musl
synced 2025-02-16 10:14:22 +03:00
cap getdents length argument to INT_MAX
the linux syscall treats this argument as having type int, so passing extremely long buffer sizes would be misinterpreted by the kernel. since "short reads" are always acceptable, just cap it down. patch based on report and suggested change by Florian Weimer.
This commit is contained in:
parent
54b7564b72
commit
3d178a7e2b
@ -1,9 +1,11 @@
|
||||
#define _BSD_SOURCE
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include "syscall.h"
|
||||
|
||||
int getdents(int fd, struct dirent *buf, size_t len)
|
||||
{
|
||||
if (len>INT_MAX) len = INT_MAX;
|
||||
return syscall(SYS_getdents, fd, buf, len);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user