BaseReceivePack: fix reading cert lines in command loop

Add a missing continues to prevent falling through to the command
parsing section. The first continue happens when the command list is
empty, so change the condition to see whether we have read the first
line, rather than any commands.

Fix comparison to BEGIN_SIGNATURE to use raw line with newline.

Change-Id: If3d92f5ceade8ba7605847a4b2bc55ff17d119ac
This commit is contained in:
Dave Borowitz 2015-06-15 14:54:13 -04:00
parent 4831470581
commit e26d0c8ace
1 changed files with 8 additions and 4 deletions

View File

@ -1043,6 +1043,7 @@ public void sendAdvertisedRefs(final RefAdvertiser adv)
* @throws IOException
*/
protected void recvCommands() throws IOException {
FirstLine firstLine = null;
for (;;) {
String rawLine;
try {
@ -1062,18 +1063,21 @@ protected void recvCommands() throws IOException {
continue;
}
if (commands.isEmpty()) {
final FirstLine firstLine = new FirstLine(line);
if (firstLine == null) {
firstLine = new FirstLine(line);
enabledCapabilities = firstLine.getCapabilities();
line = firstLine.getLine();
if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT))
if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) {
pushCertificateParser.receiveHeader(pckIn,
!isBiDirectionalPipe());
continue;
}
}
if (line.equals(PushCertificateParser.BEGIN_SIGNATURE)) {
if (rawLine.equals(PushCertificateParser.BEGIN_SIGNATURE)) {
pushCertificateParser.receiveSignature(pckIn);
continue;
}
if (line.length() < 83) {