X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_auth.c;h=02b7399c716b3d00a01302edd67c3e4a66a5e4d3;hb=8c10a4131f19dc27b0bc56ef48ae481d1fa03cb0;hp=d4bb4074f69efd82b90aaa94aa3f42198d709d6a;hpb=bcac314fe2d758e85335d499dbb4300bfa8a599e;p=tinc diff --git a/src/protocol_auth.c b/src/protocol_auth.c index d4bb4074..02b7399c 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -1,7 +1,7 @@ /* protocol_auth.c -- handle the meta-protocol, authentication Copyright (C) 1999-2005 Ivo Timmermans, - 2000-2017 Guus Sliepen + 2000-2022 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -246,7 +246,7 @@ static bool receive_invitation_sptps(void *handle, uint8_t type, const void *dat memcpy(hashbuf, data, 18); memcpy(hashbuf + 18, fingerprint, sizeof(hashbuf) - 18); sha512(hashbuf, sizeof(hashbuf), cookie); - b64encode_urlsafe(cookie, cookie, 18); + b64encode_tinc_urlsafe(cookie, cookie, 18); free(fingerprint); char filename[PATH_MAX], usedname[PATH_MAX]; @@ -287,7 +287,12 @@ static bool receive_invitation_sptps(void *handle, uint8_t type, const void *dat // Read the new node's Name from the file char buf[1024] = ""; - fgets(buf, sizeof(buf), f); + + if(!fgets(buf, sizeof(buf), f)) { + logger(DEBUG_ALWAYS, LOG_ERR, "Could not read invitation file %s\n", cookie); + return false; + } + size_t buflen = strlen(buf); // Strip whitespace at the end