def _test_env_var_size():
# max seems to be 1024 * 127
"""Private function to verify the maximum command line payload size.
This should be smatter and bisect, but it doesn't
"""
for f in range(256, 100, -1):
payload = 'a' * 1024 * f
try:
cmd = ["ssh", "-t"] + sys.argv[1:] +\
["wc -c <<<'{}' ; sleep 0.2 ; exit".format(payload)]
if call(cmd) == 0:
print("%s is good" % f)
print(len(payload))
break
except OSError as e:
if e.errno == errno.E2BIG:
pass
评论列表
文章目录