X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fuxputty.c;h=f0b4bfbda75b1666946c2b043cf896208c465f04;hb=89da2ddf564a93414ee9ab2df3f053608094e417;hp=c7b0fcb2209c05a97db9be7caf7d6d71ec9543ad;hpb=fb4fbe11588d3e53be99909f57dd179d1105aaf5;p=PuTTY.git diff --git a/unix/uxputty.c b/unix/uxputty.c index c7b0fcb2..f0b4bfbd 100644 --- a/unix/uxputty.c +++ b/unix/uxputty.c @@ -50,9 +50,11 @@ static int got_host = 0; const int use_event_log = 1, new_session = 1, saved_sessions = 1; -int process_nonoption_arg(char *arg, Conf *conf, int *allow_launch) +int process_nonoption_arg(const char *arg, Conf *conf, int *allow_launch) { - char *p, *q = arg; + char *argdup, *p, *q; + argdup = dupstr(arg); + q = argdup; if (got_host) { /* @@ -61,7 +63,7 @@ int process_nonoption_arg(char *arg, Conf *conf, int *allow_launch) * argument, so that it will be deferred until it's a good * moment to run it. */ - int ret = cmdline_process_param("-P", arg, 1, conf); + int ret = cmdline_process_param("-P", argdup, 1, conf); assert(ret == 2); } else if (!strncmp(q, "telnet:", 7)) { /* @@ -90,7 +92,7 @@ int process_nonoption_arg(char *arg, Conf *conf, int *allow_launch) /* * Otherwise, treat this argument as a host name. */ - p = arg; + p = argdup; while (*p && !isspace((unsigned char)*p)) p++; if (*p) @@ -100,6 +102,9 @@ int process_nonoption_arg(char *arg, Conf *conf, int *allow_launch) } if (got_host) *allow_launch = TRUE; + + sfree(argdup); + return 1; }