[Git][NTPsec/ntpsec][master] In packet.py, more aggressive NUL-stripping.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Nov 2 19:59:30 UTC 2016


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


Commits:
a804c615 by Eric S. Raymond at 2016-11-02T15:59:21-04:00
In packet.py, more aggressive NUL-stripping.

- - - - -


1 changed file:

- pylib/packet.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -690,15 +690,13 @@ 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:
+                    while pair.endswith(b"\x00"):
+                        pair = pair[:-1]
                     eq = pair.index("=")
                     var = pair[:eq].strip()
                     val = pair[eq+1:].strip()



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


More information about the vc mailing list