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

This commit is contained in:
2026-07-20 22:00:58 +02:00
parent 5d819f7388
commit cdd6d1cfed
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) { bool use_sendfile, unsigned long long chunk_size) {
Config* config = malloc(sizeof(Config)); Config* config = malloc(sizeof(Config));
if (config == NULL) return NULL; if (config == NULL)
return NULL;
config->version = version; config->version = version;
config->send_directory = send_directory; config->send_directory = send_directory;
config->receive_root_directory = receive_directory; config->receive_root_directory = receive_directory;
@@ -255,7 +256,8 @@ Config* config_receive(int file_descriptor) {
if (!receive_int(file_descriptor, &ec)) if (!receive_int(file_descriptor, &ec))
goto error; goto error;
if (ec > MAX_PATTERN_COUNT) { 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; goto error;
} }
if ((size_t)ec > SIZE_MAX / sizeof(char*)) { if ((size_t)ec > SIZE_MAX / sizeof(char*)) {
@@ -287,7 +289,8 @@ Config* config_receive(int file_descriptor) {
if (!receive_int(file_descriptor, &ic)) if (!receive_int(file_descriptor, &ic))
goto error; goto error;
if (ic > MAX_PATTERN_COUNT) { 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; goto error;
} }
if ((size_t)ic > SIZE_MAX / sizeof(char*)) { 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) { if (file->type == FILE_TYPE_SYMLINK && file->link_target) {
// Validate link_target — reject absolute paths or traversal // Validate link_target — reject absolute paths or traversal
if (file->link_target[0] == '/' || strstr(file->link_target, "..") != NULL) { 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; return false;
} }
char* disk_path = path_cat((char*)root_directory, file->path); 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) if (!present)
return NULL; return NULL;
FileMetadata* m = malloc(sizeof(FileMetadata)); FileMetadata* m = malloc(sizeof(FileMetadata));
if (m == NULL) return NULL; if (m == NULL)
return NULL;
int32_t mode; int32_t mode;
memcpy(&mode, *buf, sizeof(mode)); memcpy(&mode, *buf, sizeof(mode));
*buf += sizeof(mode); *buf += sizeof(mode);
+2 -1
View File
@@ -165,7 +165,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); int fd = accept(server->file_descriptor, (struct sockaddr*)&client_addr, &client_len);
if (fd < 0) { if (fd < 0) {
if (errno == EINTR) { if (errno == EINTR) {
if (g_tcp_cleanup_requested) break; if (g_tcp_cleanup_requested)
break;
continue; continue;
} }
perror("Could not accept the connection"); 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 // Set SNI and enable hostname verification
SSL_set_tlsext_host_name(ssl, host); 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) { if (param) {
X509_VERIFY_PARAM_set1_host(param, host, 0); X509_VERIFY_PARAM_set1_host(param, host, 0);
} }