mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 09:23:25 +00:00
Add check for negative timeval_t.sec
in do_futimesat
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
179705a3fc
commit
cbe85a1878
@ -189,7 +189,13 @@ fn do_futimesat(
|
||||
) -> Result<SyscallReturn> {
|
||||
let times = if timeval_ptr != 0 {
|
||||
let (autime, mutime) = read_time_from_user::<timeval_t>(timeval_ptr, ctx)?;
|
||||
if autime.usec >= 1000000 || autime.usec < 0 || mutime.usec >= 1000000 || mutime.usec < 0 {
|
||||
if autime.usec >= 1000000
|
||||
|| autime.usec < 0
|
||||
|| autime.sec < 0
|
||||
|| mutime.usec >= 1000000
|
||||
|| mutime.usec < 0
|
||||
|| mutime.sec < 0
|
||||
{
|
||||
return_errno_with_message!(Errno::EINVAL, "Invalid time");
|
||||
}
|
||||
let (autime, mutime) = (timespec_t::from(autime), timespec_t::from(mutime));
|
||||
|
Reference in New Issue
Block a user