Skip to content

Commit

Permalink
Do not allow UTIME_OMIT and UTIME_NOW
Browse files Browse the repository at this point in the history
They should not be sent by qvm-copy, so do not allow them.

Suggested-by: Marek Marczykowski-Górecki <[email protected]>
  • Loading branch information
DemiMarie committed Jan 31, 2023
1 parent ddf04b9 commit da18bd6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions qrexec-lib/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ void send_status_and_crc(int code, const char *last_filename) {
static long validate_utime_nsec(uint32_t untrusted_nsec)
{
enum { MAX_NSEC = 999999999L };
_Static_assert(UTIME_NOW > MAX_NSEC && UTIME_NOW <= UINT32_MAX, "bad UTIME_NOW");
_Static_assert(UTIME_OMIT > MAX_NSEC && UTIME_OMIT <= UINT32_MAX, "bad UTIME_OMIT");
if (untrusted_nsec != UTIME_NOW &&
untrusted_nsec != UTIME_OMIT &&
untrusted_nsec > MAX_NSEC)
if (untrusted_nsec > MAX_NSEC)
errx(1, "Invalid nanoseconds value %" PRIu32, untrusted_nsec);
return (long)untrusted_nsec;
}
Expand Down

0 comments on commit da18bd6

Please sign in to comment.