NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/53476: crontab: Randomly selected number (question mark) may be negative
>Number: 53476
>Category: bin
>Synopsis: crontab: Randomly selected number (question mark) may be negative
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 28 12:10:00 +0000 2018
>Originator: Michael Kaufmann
>Release: 8.0
>Organization:
>Environment:
NetBSD cubieboard 8.0 NetBSD 8.0 (CUBIEBOARD) #0: Tue Jul 17 14:59:51 UTC 2018 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/CUBIEBOARD evbarm
>Description:
A crontab entry may contain a question mark '?', e.g.
? 3 * * * $HOME/task.sh
Sometimes crontab fails when activating such a configuration:
crontab: installing new crontab
"/tmp/crontab.8GkRCbU1KQ":1: bad minute
crontab: errors in crontab file, can't install.
The reason is that sometimes a negative value (out of range) is chosen for the minute.
>How-To-Repeat:
Configure this job with "crontab -e":
? 3 * * * $HOME/task.sh
Repeat this multiple times. It will fail in about half of the tries.
>Fix:
The bug is in the "random_with_range" function:
return (int)arc4random() % (high - low + 1) + low;
Proposed bugfix:
return (int)(arc4random() % (high - low + 1) + low);
Home |
Main Index |
Thread Index |
Old Index