restore the security check around recalculatesleep

This commit is contained in:
bunnie 2022-05-24 16:28:16 +08:00
parent bdc43a5190
commit 5815eae023

View file

@ -629,7 +629,11 @@ fn xmain() -> ! {
// If we're being asked to recalculate due to a timeout expiring, drop the sent
// message from the `entries` list.
if (request_kind == RequestKind::Timeout as usize)
// the first check confirms that the origin of the RecalculateSleep message is the Ticktimer,
// to prevent third-party servers from issuing the command and thus distorting the sleep
// calculations (since this is a public API, anything could happen).
if (msg.sender.pid().map(|p| p.get()).unwrap_or_default() as u32) == xous::process::id()
&& (request_kind == RequestKind::Timeout as usize)
&& (sender > 0)
{
let entries = notify_hash