[Git][NTPsec/ntpsec][master] More hardening against buggy servers.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Nov 2 20:06:00 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
05cf9409 by Eric S. Raymond at 2016-11-02T16:05:49-04:00
More hardening against buggy servers.

- - - - -


1 changed file:

- pylib/packet.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -690,11 +690,16 @@ class Mode6Session:
 
     def __parse_varlist(self):
         "Parse a response as a textual varlist."
+        # Trim trailing NULs from the text
+        response = self.response
+        while response.endswith(b"\x00"):
+            response = response[:-1]
         response = response.rstrip()
         items = []
         if response:
             for pair in response.split(","):
                 try:
+                    # Yes, some servers seem to ship embedded NULs.
                     while pair.endswith(b"\x00"):
                         pair = pair[:-1]
                     eq = pair.index("=")



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/05cf94090331e10bb8f021369ad08e6ee07d88ba
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161102/ac6d4f91/attachment.html>


More information about the vc mailing list