Skip to content

Commit

Permalink
Strip pkt-line when negotiating Git protocol v2
Browse files Browse the repository at this point in the history
This makes it so both "version 2" and "version 2\n" (and any
alternatives with more whitespace) are accepted as a successful v2
response.

Fixes #1423
  • Loading branch information
Lordshinjo committed Nov 7, 2024
1 parent c1008ee commit 4cb28d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dulwich/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def handle_packet(self, pkt):

def negotiate_protocol_version(proto):
pkt = proto.read_pkt_line()
if pkt == b"version 2\n":
if pkt is not None and pkt.strip() == b"version 2":
return 2
proto.unread_pkt_line(pkt)
return 0
Expand Down

0 comments on commit 4cb28d1

Please sign in to comment.