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

This commit is contained in:
2026-07-20 17:32:49 +02:00
parent 41e814ad97
commit fd7e98cb25
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -140,8 +140,14 @@ static int send_single_file(Client* client, File* file, Config* config, bool use
delta_signature_destroy(sig);
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);
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)
if (!file_send_sendfile(file, client->file_descriptor, config->use_metadata, 0, false))
return -1;
+1
View File
@@ -141,6 +141,7 @@ Config* config_receive(int file_descriptor) {
Config* config = (Config*)malloc(sizeof(Config));
if (config == NULL)
return NULL;
memset(config, 0, sizeof(*config));
config->version = receive_str(file_descriptor);
if (!config->version) {
free(config);