@@ -227,9 +227,9 @@ int ssh_start_isolated_agent(ssh_config_t *ssh_config, const account_t *account) |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /* Build ssh-agent command with socket path */ |
| 230 | | - if (snprintf(command, sizeof(command), |
| 231 | | - "ssh-agent -a '%s/ssh-agent.%s.sock'", |
| 232 | | - socket_dir, account->name) >= sizeof(command)) { |
| 230 | + if ((size_t)snprintf(command, sizeof(command), |
| 231 | + "ssh-agent -a '%s/ssh-agent.%s.sock'", |
| 232 | + socket_dir, account->name) >= sizeof(command)) { |
| 233 | 233 | set_error(ERR_INVALID_ARGS, "SSH agent command too long"); |
| 234 | 234 | return -1; |
| 235 | 235 | } |
@@ -359,7 +359,7 @@ int ssh_add_key(ssh_config_t *ssh_config, const char *key_path) { |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /* Build ssh-add command */ |
| 362 | | - if (snprintf(command, sizeof(command), "ssh-add '%s'", key_path) >= sizeof(command)) { |
| 362 | + if ((size_t)snprintf(command, sizeof(command), "ssh-add '%s'", key_path) >= sizeof(command)) { |
| 363 | 363 | set_error(ERR_INVALID_ARGS, "SSH add command too long"); |
| 364 | 364 | return -1; |
| 365 | 365 | } |
@@ -483,7 +483,7 @@ int ssh_configure_host_alias(const account_t *account) { |
| 483 | 483 | log_debug("Configuring SSH host alias: %s", account->ssh_host_alias); |
| 484 | 484 | |
| 485 | 485 | /* Get SSH config directory */ |
| 486 | | - if (snprintf(ssh_config_dir, sizeof(ssh_config_dir), "%s/.ssh", getenv("HOME")) >= sizeof(ssh_config_dir)) { |
| 486 | + if ((size_t)snprintf(ssh_config_dir, sizeof(ssh_config_dir), "%s/.ssh", getenv("HOME")) >= sizeof(ssh_config_dir)) { |
| 487 | 487 | set_error(ERR_INVALID_PATH, "SSH config directory path too long"); |
| 488 | 488 | return -1; |
| 489 | 489 | } |
@@ -496,7 +496,7 @@ int ssh_configure_host_alias(const account_t *account) { |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /* SSH config file path */ |
| 499 | | - if (snprintf(ssh_config_path, sizeof(ssh_config_path), "%s/config", ssh_config_dir) >= sizeof(ssh_config_path)) { |
| 499 | + if ((size_t)snprintf(ssh_config_path, sizeof(ssh_config_path), "%s/config", ssh_config_dir) >= sizeof(ssh_config_path)) { |
| 500 | 500 | set_error(ERR_INVALID_PATH, "SSH config file path too long"); |
| 501 | 501 | return -1; |
| 502 | 502 | } |
@@ -547,9 +547,9 @@ int ssh_test_connection(const account_t *account, const char *host) { |
| 547 | 547 | /* Build SSH test command */ |
| 548 | 548 | if (strlen(account->ssh_host_alias) > 0) { |
| 549 | 549 | /* Use host alias */ |
| 550 | | - if (snprintf(command, sizeof(command), |
| 551 | | - "ssh -o ConnectTimeout=5 -o BatchMode=yes %s echo 'SSH connection test successful'", |
| 552 | | - account->ssh_host_alias) >= sizeof(command)) { |
| 550 | + if ((size_t)snprintf(command, sizeof(command), |
| 551 | + "ssh -o ConnectTimeout=5 -o BatchMode=yes %s echo 'SSH connection test successful'", |
| 552 | + account->ssh_host_alias) >= sizeof(command)) { |
| 553 | 553 | set_error(ERR_INVALID_ARGS, "SSH test command too long"); |
| 554 | 554 | return -1; |
| 555 | 555 | } |
@@ -560,9 +560,9 @@ int ssh_test_connection(const account_t *account, const char *host) { |
| 560 | 560 | return -1; |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | | - if (snprintf(command, sizeof(command), |
| 564 | | - "ssh -o ConnectTimeout=5 -o BatchMode=yes -i '%s' %s echo 'SSH connection test successful'", |
| 565 | | - expanded_key_path, host) >= sizeof(command)) { |
| 563 | + if ((size_t)snprintf(command, sizeof(command), |
| 564 | + "ssh -o ConnectTimeout=5 -o BatchMode=yes -i '%s' %s echo 'SSH connection test successful'", |
| 565 | + expanded_key_path, host) >= sizeof(command)) { |
| 566 | 566 | set_error(ERR_INVALID_ARGS, "SSH test command too long"); |
| 567 | 567 | return -1; |
| 568 | 568 | } |
@@ -663,12 +663,12 @@ static int create_isolated_agent_socket_dir(char *socket_dir, size_t socket_dir_ |
| 663 | 663 | |
| 664 | 664 | /* Prefer XDG_RUNTIME_DIR if available */ |
| 665 | 665 | if (runtime_dir && path_exists(runtime_dir)) { |
| 666 | | - if (snprintf(socket_dir, socket_dir_size, "%s/gitswitch-ssh", runtime_dir) >= socket_dir_size) { |
| 666 | + if ((size_t)snprintf(socket_dir, socket_dir_size, "%s/gitswitch-ssh", runtime_dir) >= socket_dir_size) { |
| 667 | 667 | set_error(ERR_INVALID_PATH, "Socket directory path too long"); |
| 668 | 668 | return -1; |
| 669 | 669 | } |
| 670 | 670 | } else { |
| 671 | | - if (snprintf(socket_dir, socket_dir_size, "%s/gitswitch-ssh-%d", tmp_dir, getuid()) >= socket_dir_size) { |
| 671 | + if ((size_t)snprintf(socket_dir, socket_dir_size, "%s/gitswitch-ssh-%d", tmp_dir, getuid()) >= socket_dir_size) { |
| 672 | 672 | set_error(ERR_INVALID_PATH, "Socket directory path too long"); |
| 673 | 673 | return -1; |
| 674 | 674 | } |