mirror of
git://git.musl-libc.org/musl
synced 2024-11-23 18:14:19 +08:00
fix invalid access by openat to possibly-missing variadic mode argument
the mode argument is only required to be present when the O_CREAT or O_TMPFILE flag is used.
This commit is contained in:
parent
9d836ea7a6
commit
2da3ab1382
@ -6,10 +6,14 @@
|
||||
int openat(int fd, const char *filename, int flags, ...)
|
||||
{
|
||||
mode_t mode;
|
||||
va_list ap;
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
|
||||
if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) {
|
||||
va_list ap;
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
return syscall_cp(SYS_openat, fd, filename, flags|O_LARGEFILE, mode);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user