Fix http_protocol parsing crash discovered with pathoc fuzzing.

This commit is contained in:
Aldo Cortesi 2012-07-22 12:35:16 +12:00
parent 619f3c6edc
commit ed64b0e796

View File

@ -141,10 +141,10 @@ def parse_http_protocol(s):
"""
if not s.startswith("HTTP/"):
return None
_, version = s.split('/')
_, version = s.split('/', 1)
if "." not in version:
return None
major, minor = version.split('.')
major, minor = version.split('.', 1)
try:
major = int(major)
minor = int(minor)