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
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:
+6
-3
@@ -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
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user