diff hglib/client.py @ 201:67398bbf788d 2.6

client: do not accept NULL character as command arguments It would break the data structure, and it's also invalid as a shell command.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 25 Apr 2018 21:27:02 +0900
parents 7da1dad166b5
children 388820908580
line wrap: on
line diff
--- a/hglib/client.py	Mon Feb 12 14:54:09 2018 +0100
+++ b/hglib/client.py	Wed Apr 25 21:27:02 2018 +0900
@@ -183,6 +183,8 @@
         if not self.server:
             raise ValueError("server not connected")
 
+        if any(b('\0') in a for a in args):
+            raise ValueError('null character in command arguments')
         self.server.stdin.write(b('runcommand\n'))
         writeblock(b('\0').join(args))