fix: satisfy static analysis in review paths
CI / lint (pull_request) Failing after 31s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped

This commit is contained in:
2026-08-10 17:27:33 +02:00
parent 7776a63d3d
commit 44c2a8bb79
3 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -170,7 +170,7 @@ bool file_save_to_disk(const char* root_directory, File* file, const Config* con
(backup_enabled &&
(!backup_suffix || backup_suffix[0] == '\0' || strchr(backup_suffix, '/') != NULL ||
strcmp(backup_suffix, ".") == 0 || strcmp(backup_suffix, "..") == 0))) {
log_message(LOG_LEVEL_ERROR, "Path traversal detected in file path: %s", file->path);
log_message(LOG_LEVEL_ERROR, "Invalid file or path received");
return false;
}
@@ -545,7 +545,6 @@ File* receive_incremental_check(int fd, const Config* config, bool* skipped) {
}
if (old_fd >= 0) {
close(old_fd);
old_fd = -1;
}
bool match = has_old_file && (unsigned long long)st.st_size == check_size;
+1 -1
View File
@@ -188,7 +188,7 @@ void file_restore_metadata(const char* path, FileMetadata* metadata) {
log_message(LOG_LEVEL_WARNING, "Failed to set timestamps on %s: %s", path, strerror(errno));
}
bool file_restore_metadata_fd(int fd, FileMetadata* metadata) {
bool file_restore_metadata_fd(int fd, const FileMetadata* metadata) {
if (fd < 0 || metadata == NULL)
return metadata == NULL;
bool ok = true;
+1 -1
View File
@@ -30,6 +30,6 @@ FileMetadata* metadata_from_buf(char** buf);
bool metadata_send(int file_descriptor, FileMetadata* m);
FileMetadata* metadata_receive(int file_descriptor, int* ok);
void file_restore_metadata(const char* path, FileMetadata* metadata);
bool file_restore_metadata_fd(int fd, FileMetadata* metadata);
bool file_restore_metadata_fd(int fd, const FileMetadata* metadata);
#endif