Sebastian Kuschel reports that pfd_closing can be called for a socket
[u/mdw/putty] / cmdline.c
index cf114c0..a4c9160 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
@@ -63,7 +63,7 @@ void cmdline_cleanup(void)
     int pri;
 
     if (cmdline_password) {
-       memset(cmdline_password, 0, strlen(cmdline_password));
+       smemclr(cmdline_password, strlen(cmdline_password));
        sfree(cmdline_password);
        cmdline_password = NULL;
     }
@@ -105,15 +105,12 @@ int cmdline_get_passwd_input(prompts_t *p, unsigned char *in, int inlen) {
     if (tried_once)
        return 0;
 
-    strncpy(p->prompts[0]->result, cmdline_password,
-           p->prompts[0]->result_len);
-    p->prompts[0]->result[p->prompts[0]->result_len-1] = '\0';
-    memset(cmdline_password, 0, strlen(cmdline_password));
+    prompt_set_result(p->prompts[0], cmdline_password);
+    smemclr(cmdline_password, strlen(cmdline_password));
     sfree(cmdline_password);
     cmdline_password = NULL;
     tried_once = 1;
     return 1;
-
 }
 
 /*
@@ -371,7 +368,7 @@ int cmdline_process_param(char *p, char *value, int need_save, Conf *conf)
            /* Assuming that `value' is directly from argv, make a good faith
             * attempt to trample it, to stop it showing up in `ps' output
             * on Unix-like systems. Not guaranteed, of course. */
-           memset(value, 0, strlen(value));
+           smemclr(value, strlen(value));
        }
     }
 
@@ -457,12 +454,13 @@ int cmdline_process_param(char *p, char *value, int need_save, Conf *conf)
     }
 
     if (!strcmp(p, "-i")) {
-       Filename fn;
+       Filename *fn;
        RETURN(2);
        UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
        SAVEABLE(0);
        fn = filename_from_str(value);
-       conf_set_filename(conf, CONF_keyfile, &fn);
+       conf_set_filename(conf, CONF_keyfile, fn);
+        filename_free(fn);
     }
 
     if (!strcmp(p, "-4") || !strcmp(p, "-ipv4")) {
@@ -504,6 +502,10 @@ int cmdline_process_param(char *p, char *value, int need_save, Conf *conf)
                    break;
 
                  case '5':
+                 case '6':
+                 case '7':
+                 case '8':
+                 case '9':
                    conf_set_int(conf, CONF_serdatabits, *nextitem-'0');
                    break;