1
1
Этот коммит содержится в:
Aris Adamantiadis 2009-09-26 12:28:03 +02:00
родитель f643c34ee8
Коммит 2a2616f65c

Просмотреть файл

@ -237,18 +237,18 @@ static int ssh_options_set_algo(ssh_options opt, int algo, const char *list) {
}
static char *dir_expand_dup(ssh_options opt, const char *value, int allowsshdir) {
char *n;
char *new;
if (value[0] == '~' && value[1] == '/') {
const char *homedir = ssh_get_user_home_dir();
size_t lv = strlen(value + 1), lh = strlen(homedir);
n = malloc(lv + lh + 1);
if (n == NULL)
new = malloc(lv + lh + 1);
if (new == NULL)
return NULL;
memcpy(n, homedir, lh);
memcpy(n + lh + 1, value + 1, lv + 1);
return n;
memcpy(new, homedir, lh);
memcpy(new + lh, value + 1, lv + 1);
return new;
}
if (allowsshdir && strncmp(value, "SSH_DIR/", 8) == 0) {
size_t lv, ls;
@ -261,12 +261,12 @@ static char *dir_expand_dup(ssh_options opt, const char *value, int allowsshdir)
lv = strlen(value);
ls = strlen(opt->ssh_dir);
n = malloc(lv + ls + 1);
if (n == NULL)
new = malloc(lv + ls + 1);
if (new == NULL)
return NULL;
memcpy(n, opt->ssh_dir, ls);
memcpy(n + ls + 1, value, lv + 1);
return n;
memcpy(new, opt->ssh_dir, ls);
memcpy(new + ls, value, lv + 1);
return new;
}
return strdup(value);
}