[Git][NTPsec/ntpsec][master] Fix two ntpmon crash bugs.
Eric S. Raymond
gitlab at mg.gitlab.com
Sat Dec 10 16:46:41 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
78ceea02 by Eric S. Raymond at 2016-12-10T11:46:09-05:00
Fix two ntpmon crash bugs.
- - - - -
2 changed files:
- ntpclients/ntpmon
- pylib/packet.py
Changes:
=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -32,12 +32,14 @@ def iso8601(t):
"ISO8601 string from Unix time, including fractional second."
return time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(time.time()))
-
def statline(_peerlist, _mrulist):
"Generate a status line"
# We don't use stdversion here because the presence of a date is confusing
leader = sysvars['version']
- trailer = "Last update: %s" % iso8601(span.entries[0].last)
+ if span.entries:
+ trailer = "Last update: %s" % iso8601(span.entries[0].last)
+ else:
+ trailer = ""
spacer = (peer_report.termwidth - len(leader) - len(trailer)) * " "
return leader + spacer + trailer
=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -866,6 +866,7 @@ class ControlSession:
pkt = ControlPacket(self, opcode, associd, qdata)
self.sequence += 1
+ self.sequence %= 65536 # Has to fit in a struct H field
pkt.sequence = self.sequence
# If we have data, pad it out to a 32-bit boundary.
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/78ceea028cd6e08eabf4c6b7ea94af4aad03e910
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161210/5571f60e/attachment.html>
More information about the vc
mailing list