X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finvitation.c;h=5dc8c6300e452819caa3c963b44b843886bcf9a8;hb=696dc2ad9743c62e56a6d21addb8c4e8efbffec1;hp=bcb79a489b72bc654686e062cdbf341ef9dc6a50;hpb=f6e87ab476a0faf8b124ecaaa27f967d825e6457;p=tinc diff --git a/src/invitation.c b/src/invitation.c index bcb79a48..5dc8c630 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -769,13 +769,19 @@ make_names: l[len] = 0; + // Ignore lines with empty variable names + if(!*l) { + continue; + } + // Is it a Name? - if(!strcasecmp(l, "Name")) + if(!strcasecmp(l, "Name")) { if(strcmp(value, name)) { break; } else { continue; - } else if(!strcasecmp(l, "NetName")) { + } + } else if(!strcasecmp(l, "NetName")) { continue; } @@ -1234,7 +1240,7 @@ next: char hisname[4096] = ""; int code, hismajor, hisminor = 0; - if(!recvline(sock, line, sizeof(line)) || sscanf(line, "%d %4095s %d.%d", &code, hisname, &hismajor, &hisminor) < 3 || code != 0 || hismajor != PROT_MAJOR || !check_id(hisname) || !recvline(sock, line, sizeof line) || !rstrip(line) || sscanf(line, "%d ", &code) != 1 || code != ACK || strlen(line) < 3) { + if(!recvline(sock, line, sizeof(line)) || sscanf(line, "%d %4095s %d.%d", &code, hisname, &hismajor, &hisminor) < 3 || code != 0 || hismajor != PROT_MAJOR || !check_id(hisname) || !recvline(sock, line, sizeof(line)) || !rstrip(line) || sscanf(line, "%d ", &code) != 1 || code != ACK || strlen(line) < 3) { fprintf(stderr, "Cannot read greeting from peer\n"); closesocket(sock); goto next;