-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jk/harden-protocol-v2-delim-handling'
The server-end of the v2 protocol to serve "git clone" and "git fetch" was not prepared to see a delim packets at unexpected places, which led to a crash. * jk/harden-protocol-v2-delim-handling: test-lib-functions: simplify packetize() stdin code upload-pack: handle unexpected delim packets test-lib-functions: make packetize() more efficient
- Loading branch information
Showing
5 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
test_description='Test responses to violations of the network protocol. In most | ||
of these cases it will generally be acceptable for one side to break off | ||
communications if the other side says something unexpected. We are mostly | ||
making sure that we do not segfault or otherwise behave badly.' | ||
. ./test-lib.sh | ||
|
||
test_expect_success 'extra delim packet in v2 ls-refs args' ' | ||
{ | ||
packetize command=ls-refs && | ||
printf 0001 && | ||
# protocol expects 0000 flush here | ||
printf 0001 | ||
} >input && | ||
test_must_fail env GIT_PROTOCOL=version=2 \ | ||
git upload-pack . <input 2>err && | ||
test_i18ngrep "expected flush after ls-refs arguments" err | ||
' | ||
|
||
test_expect_success 'extra delim packet in v2 fetch args' ' | ||
{ | ||
packetize command=fetch && | ||
printf 0001 && | ||
# protocol expects 0000 flush here | ||
printf 0001 | ||
} >input && | ||
test_must_fail env GIT_PROTOCOL=version=2 \ | ||
git upload-pack . <input 2>err && | ||
test_i18ngrep "expected flush after fetch arguments" err | ||
' | ||
|
||
test_done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters