[cookies] Fix --cookies-from-browser=safari with unusual field order

These fields can be specified in any order. `DataParser` doesn't support skipping backwards, so I make a temporary copy for each.
This commit is contained in:
rcombs 2024-05-03 17:42:02 -07:00 committed by GitHub
parent ac817bc83e
commit bab2e67113
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 6 deletions

View File

@ -645,14 +645,17 @@ def _parse_safari_cookies_record(data, jar, logger):
_creation_date = _mac_absolute_time_to_posix(p.read_double()) # noqa: F841
try:
p.skip_to(domain_offset)
domain = p.read_cstring()
temp = DataParser(data, logger)
temp.skip_to(domain_offset)
domain = temp.read_cstring()
p.skip_to(name_offset)
name = p.read_cstring()
temp = DataParser(data, logger)
temp.skip_to(name_offset)
name = temp.read_cstring()
p.skip_to(path_offset)
path = p.read_cstring()
temp = DataParser(data, logger)
temp.skip_to(path_offset)
path = temp.read_cstring()
p.skip_to(value_offset)
value = p.read_cstring()