Validate values read from the RTC before trying BCD decoding
Submitted by: cem Reported by: Michael Gmelin <freebsd@grem.de> Tested by: Oleksandr Tymoshenko <gonzo@bluezbox.com> Sponsored by: Dell EMC
This commit is contained in:
parent
ad33b77611
commit
38ef0279a4
@ -102,7 +102,12 @@ writertc(int reg, u_char val)
|
||||
static __inline int
|
||||
readrtc(int port)
|
||||
{
|
||||
return(bcd2bin(rtcin(port)));
|
||||
int readval;
|
||||
|
||||
readval = rtcin(port);
|
||||
if (readval >= 0 && (readval & 0xf) < 0xa && (readval & 0xf0) < 0xa0)
|
||||
return (bcd2bin(readval));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user