fix: config_receive uninitialized server_host (CRITICAL-2) & protocol desync on sendfile+delta (CRITICAL-5)
CI / lint (push) Successful in 7s
CI / lint (pull_request) Successful in 7s
CI / build-and-test (push) Successful in 53s
CI / sanitizers (address) (push) Successful in 58s
CI / clang-tidy (push) Successful in 7s
CI / build-and-test (pull_request) Successful in 56s
CI / sanitizers (address) (pull_request) Successful in 59s
CI / clang-tidy (pull_request) Successful in 5s
CI / lint (push) Successful in 7s
CI / lint (pull_request) Successful in 7s
CI / build-and-test (push) Successful in 53s
CI / sanitizers (address) (push) Successful in 58s
CI / clang-tidy (push) Successful in 7s
CI / build-and-test (pull_request) Successful in 56s
CI / sanitizers (address) (pull_request) Successful in 59s
CI / clang-tidy (pull_request) Successful in 5s
This commit is contained in:
@@ -140,8 +140,14 @@ static int send_single_file(Client* client, File* file, Config* config, bool use
|
|||||||
delta_signature_destroy(sig);
|
delta_signature_destroy(sig);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// rc == 0 or rc == 2 (delta not possible with sendfile)
|
// rc == 0: unchanged file, skip
|
||||||
|
// rc == 2: server sent delta signature but sendfile doesn't support delta
|
||||||
delta_signature_destroy(sig);
|
delta_signature_destroy(sig);
|
||||||
|
if (rc == 2) {
|
||||||
|
// Server is waiting for STATUS_NEXT after delta handshake
|
||||||
|
if (!send_status(client->file_descriptor, STATUS_NEXT))
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
// Fall through: send full file via sendfile (pass 0 for compression_level)
|
// Fall through: send full file via sendfile (pass 0 for compression_level)
|
||||||
if (!file_send_sendfile(file, client->file_descriptor, config->use_metadata, 0, false))
|
if (!file_send_sendfile(file, client->file_descriptor, config->use_metadata, 0, false))
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ Config* config_receive(int file_descriptor) {
|
|||||||
Config* config = (Config*)malloc(sizeof(Config));
|
Config* config = (Config*)malloc(sizeof(Config));
|
||||||
if (config == NULL)
|
if (config == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
memset(config, 0, sizeof(*config));
|
||||||
config->version = receive_str(file_descriptor);
|
config->version = receive_str(file_descriptor);
|
||||||
if (!config->version) {
|
if (!config->version) {
|
||||||
free(config);
|
free(config);
|
||||||
|
|||||||
Reference in New Issue
Block a user