We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 501271b commit b135201Copy full SHA for b135201
src/utility/time/NTPUtils.cpp
@@ -62,6 +62,12 @@ unsigned long NTPUtils::getTime(UDP & udp)
62
unsigned long const highWord = word(ntp_packet_buf[40], ntp_packet_buf[41]);
63
unsigned long const lowWord = word(ntp_packet_buf[42], ntp_packet_buf[43]);
64
unsigned long const secsSince1900 = highWord << 16 | lowWord;
65
+
66
+ /* Check for corrupted NTP response */
67
+ if(secsSince1900 == 0) {
68
+ return 0;
69
+ }
70
71
unsigned long const seventyYears = 2208988800UL;
72
unsigned long const epoch = secsSince1900 - seventyYears;
73
0 commit comments