Compare commits

...

3 Commits

8
otp.c
View File

@@ -2611,7 +2611,7 @@ int load_preferences(void) {
} }
char preferences_dir[1024]; char preferences_dir[1024];
char preferences_file[1024]; char preferences_file[2048]; // Increased buffer size to accommodate longer paths
snprintf(preferences_dir, sizeof(preferences_dir), "%s/.otp", home_dir); snprintf(preferences_dir, sizeof(preferences_dir), "%s/.otp", home_dir);
snprintf(preferences_file, sizeof(preferences_file), "%s/otp.conf", preferences_dir); snprintf(preferences_file, sizeof(preferences_file), "%s/otp.conf", preferences_dir);
@@ -2659,7 +2659,7 @@ int save_preferences(void) {
} }
char preferences_dir[1024]; char preferences_dir[1024];
char preferences_file[1024]; char preferences_file[2048]; // Increased buffer size to accommodate longer paths
snprintf(preferences_dir, sizeof(preferences_dir), "%s/.otp", home_dir); snprintf(preferences_dir, sizeof(preferences_dir), "%s/.otp", home_dir);
snprintf(preferences_file, sizeof(preferences_file), "%s/otp.conf", preferences_dir); snprintf(preferences_file, sizeof(preferences_file), "%s/otp.conf", preferences_dir);
@@ -2748,7 +2748,7 @@ int detect_otp_thumb_drive(char* otp_drive_path, size_t path_size) {
// Check if drive name starts with "OTP" // Check if drive name starts with "OTP"
if (strncmp(user_entry->d_name, "OTP", 3) != 0) continue; if (strncmp(user_entry->d_name, "OTP", 3) != 0) continue;
char user_mount_path[1024]; // Increased buffer size char user_mount_path[2048]; // Increased buffer size
// Verify buffer has enough space before concatenation // Verify buffer has enough space before concatenation
size_t mount_len = strlen(mount_path); size_t mount_len = strlen(mount_path);
size_t entry_len = strlen(user_entry->d_name); size_t entry_len = strlen(user_entry->d_name);
@@ -2780,7 +2780,7 @@ int detect_otp_thumb_drive(char* otp_drive_path, size_t path_size) {
// Check if drive name starts with "OTP" // Check if drive name starts with "OTP"
if (strncmp(user_entry->d_name, "OTP", 3) != 0) continue; if (strncmp(user_entry->d_name, "OTP", 3) != 0) continue;
char user_mount_path[512]; char user_mount_path[2048]; // Increased buffer size
snprintf(user_mount_path, sizeof(user_mount_path), "%s/%s", mount_path, user_entry->d_name); snprintf(user_mount_path, sizeof(user_mount_path), "%s/%s", mount_path, user_entry->d_name);
// Check if this is a readable directory // Check if this is a readable directory