Compare commits

...

5 Commits

14
otp.c
View File

@@ -46,9 +46,9 @@ static const int base64_decode_table[256] = {
// USB Pad structure for external drive detection // USB Pad structure for external drive detection
struct USBPadInfo { struct USBPadInfo {
char chksum[65]; // 64-char checksum + null terminator char chksum[65]; // 64-char checksum + null terminator
char pad_path[512]; // Full path to .pad file char pad_path[1024]; // Full path to .pad file
char state_path[512]; // Full path to .state file char state_path[1024]; // Full path to .state file
char mount_point[256]; // USB mount point for display char mount_point[1024]; // USB mount point for display
uint64_t state_offset; // Current state offset uint64_t state_offset; // Current state offset
}; };
@@ -2376,7 +2376,7 @@ int scan_usb_drives_for_pads(struct USBPadInfo** usb_pads, int* usb_count) {
while ((mount_entry = readdir(mount_dir)) != NULL && count < 100) { while ((mount_entry = readdir(mount_dir)) != NULL && count < 100) {
if (mount_entry->d_name[0] == '.') continue; if (mount_entry->d_name[0] == '.') continue;
char mount_path[512]; char mount_path[1024];
snprintf(mount_path, sizeof(mount_path), "%s/%s", mount_dirs[mount_idx], mount_entry->d_name); snprintf(mount_path, sizeof(mount_path), "%s/%s", mount_dirs[mount_idx], mount_entry->d_name);
// For /run/media, we need to go one level deeper (skip username) // For /run/media, we need to go one level deeper (skip username)
@@ -2388,7 +2388,7 @@ int scan_usb_drives_for_pads(struct USBPadInfo** usb_pads, int* usb_count) {
while ((user_entry = readdir(user_dir)) != NULL && count < 100) { while ((user_entry = readdir(user_dir)) != NULL && count < 100) {
if (user_entry->d_name[0] == '.') continue; if (user_entry->d_name[0] == '.') continue;
char user_mount_path[512]; char user_mount_path[2048];
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);
// Scan this mount point for pads // Scan this mount point for pads
@@ -2399,7 +2399,7 @@ int scan_usb_drives_for_pads(struct USBPadInfo** usb_pads, int* usb_count) {
while ((drive_entry = readdir(drive_dir)) != NULL && count < 100) { while ((drive_entry = readdir(drive_dir)) != NULL && count < 100) {
// Look for .pad files in root of drive // Look for .pad files in root of drive
if (strstr(drive_entry->d_name, ".pad") && strlen(drive_entry->d_name) == 68) { if (strstr(drive_entry->d_name, ".pad") && strlen(drive_entry->d_name) == 68) {
char pad_path[512], state_path[512]; char pad_path[2048], state_path[2048];
snprintf(pad_path, sizeof(pad_path), "%s/%s", user_mount_path, drive_entry->d_name); snprintf(pad_path, sizeof(pad_path), "%s/%s", user_mount_path, drive_entry->d_name);
// Extract checksum from filename // Extract checksum from filename
@@ -2441,7 +2441,7 @@ int scan_usb_drives_for_pads(struct USBPadInfo** usb_pads, int* usb_count) {
while ((drive_entry = readdir(drive_dir)) != NULL && count < 100) { while ((drive_entry = readdir(drive_dir)) != NULL && count < 100) {
// Look for .pad files in root of drive // Look for .pad files in root of drive
if (strstr(drive_entry->d_name, ".pad") && strlen(drive_entry->d_name) == 68) { if (strstr(drive_entry->d_name, ".pad") && strlen(drive_entry->d_name) == 68) {
char pad_path[512], state_path[512]; char pad_path[2048], state_path[2048];
snprintf(pad_path, sizeof(pad_path), "%s/%s", mount_path, drive_entry->d_name); snprintf(pad_path, sizeof(pad_path), "%s/%s", mount_path, drive_entry->d_name);
// Extract checksum from filename // Extract checksum from filename