Mercurial > python-hglib
comparison 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 |
comparison
equal
deleted
inserted
replaced
200:7da1dad166b5 | 201:67398bbf788d |
---|---|
181 self.server.stdin.flush() | 181 self.server.stdin.flush() |
182 | 182 |
183 if not self.server: | 183 if not self.server: |
184 raise ValueError("server not connected") | 184 raise ValueError("server not connected") |
185 | 185 |
186 if any(b('\0') in a for a in args): | |
187 raise ValueError('null character in command arguments') | |
186 self.server.stdin.write(b('runcommand\n')) | 188 self.server.stdin.write(b('runcommand\n')) |
187 writeblock(b('\0').join(args)) | 189 writeblock(b('\0').join(args)) |
188 | 190 |
189 while True: | 191 while True: |
190 channel, data = self._readchannel() | 192 channel, data = self._readchannel() |