fix: clang-format compliance
CI / lint (pull_request) Successful in 9s
CI / sanitizers (address) (pull_request) Successful in 14s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 9s
CI / valgrind (pull_request) Successful in 13s
CI / build-and-test (pull_request) Successful in 53s

This commit is contained in:
2026-07-20 22:01:00 +02:00
parent 58a83193ff
commit b20e39012e
6 changed files with 14 additions and 8 deletions
+6 -3
View File
@@ -15,7 +15,8 @@ Config* config_create(char* version, char* send_directory, char* receive_directo
bool use_sendfile, unsigned long long chunk_size) {
Config* config = malloc(sizeof(Config));
if (config == NULL) return NULL;
if (config == NULL)
return NULL;
config->version = version;
config->send_directory = send_directory;
config->receive_root_directory = receive_directory;
@@ -255,7 +256,8 @@ Config* config_receive(int file_descriptor) {
if (!receive_int(file_descriptor, &ec))
goto error;
if (ec > MAX_PATTERN_COUNT) {
log_message(LOG_LEVEL_ERROR, "Exclude pattern count %d exceeds maximum %d", ec, MAX_PATTERN_COUNT);
log_message(LOG_LEVEL_ERROR, "Exclude pattern count %d exceeds maximum %d", ec,
MAX_PATTERN_COUNT);
goto error;
}
if ((size_t)ec > SIZE_MAX / sizeof(char*)) {
@@ -287,7 +289,8 @@ Config* config_receive(int file_descriptor) {
if (!receive_int(file_descriptor, &ic))
goto error;
if (ic > MAX_PATTERN_COUNT) {
log_message(LOG_LEVEL_ERROR, "Include pattern count %d exceeds maximum %d", ic, MAX_PATTERN_COUNT);
log_message(LOG_LEVEL_ERROR, "Include pattern count %d exceeds maximum %d", ic,
MAX_PATTERN_COUNT);
goto error;
}
if ((size_t)ic > SIZE_MAX / sizeof(char*)) {
+2 -1
View File
@@ -203,7 +203,8 @@ bool file_save_to_disk(const char* root_directory, File* file) {
if (file->type == FILE_TYPE_SYMLINK && file->link_target) {
// Validate link_target — reject absolute paths or traversal
if (file->link_target[0] == '/' || strstr(file->link_target, "..") != NULL) {
log_message(LOG_LEVEL_ERROR, "Path traversal blocked in symlink target: %s", file->link_target);
log_message(LOG_LEVEL_ERROR, "Path traversal blocked in symlink target: %s",
file->link_target);
return false;
}
char* disk_path = path_cat((char*)root_directory, file->path);
+2 -1
View File
@@ -41,7 +41,8 @@ FileMetadata* metadata_from_buf(char** buf) {
if (!present)
return NULL;
FileMetadata* m = malloc(sizeof(FileMetadata));
if (m == NULL) return NULL;
if (m == NULL)
return NULL;
int32_t mode;
memcpy(&mode, *buf, sizeof(mode));
*buf += sizeof(mode);
+2 -1
View File
@@ -162,7 +162,8 @@ static void accept_loop(Server* server, void (*child_fn)(int, void*), void* chil
int fd = accept(server->file_descriptor, (struct sockaddr*)&client_addr, &client_len);
if (fd < 0) {
if (errno == EINTR) {
if (g_tcp_cleanup_requested) break;
if (g_tcp_cleanup_requested)
break;
continue;
}
perror("Could not accept the connection");
+1 -1
View File
@@ -171,7 +171,7 @@ bool client_connect_tls(Client* client, char* host, int port, const char* cert_p
// Set SNI and enable hostname verification
SSL_set_tlsext_host_name(ssl, host);
X509_VERIFY_PARAM *param = SSL_get0_param(ssl);
X509_VERIFY_PARAM* param = SSL_get0_param(ssl);
if (param) {
X509_VERIFY_PARAM_set1_host(param, host, 0);
}