diff options
author | nelson%bolyard.com <devnull@localhost> | 2008-03-03 20:12:22 +0000 |
---|---|---|
committer | nelson%bolyard.com <devnull@localhost> | 2008-03-03 20:12:22 +0000 |
commit | 6ad11194379288d7b594ae63c909d5d0d072714e (patch) | |
tree | b18633f630fe484563cb8730dd421d14f7075521 | |
parent | 65060441f78e5f829319d8f972bce300cdbe8d7b (diff) | |
download | nss-hg-6ad11194379288d7b594ae63c909d5d0d072714e.tar.gz |
Bug 417637: tstclnt crashes if -p option is not specified, r=julien,alexei
-rw-r--r-- | security/nss/cmd/tstclnt/tstclnt.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/security/nss/cmd/tstclnt/tstclnt.c b/security/nss/cmd/tstclnt/tstclnt.c index 5db624722..f0ce832de 100644 --- a/security/nss/cmd/tstclnt/tstclnt.c +++ b/security/nss/cmd/tstclnt/tstclnt.c @@ -496,7 +496,6 @@ int main(int argc, char **argv) PRFileDesc * std_out; CERTCertDBHandle * handle; char * host = NULL; - char * port = "443"; char * certDir = NULL; char * nickname = NULL; char * cipherString = NULL; @@ -523,7 +522,7 @@ int main(int argc, char **argv) PRBool skipProtoHeader = PR_FALSE; int headerSeparatorPtrnId = 0; int error = 0; - PRUint16 portno; + PRUint16 portno = 443; PLOptState *optstate; PLOptStatus optstatus; PRStatus prStatus; @@ -578,7 +577,7 @@ int main(int argc, char **argv) case 'o': override = 1; break; - case 'p': port = strdup(optstate->value); break; + case 'p': portno = (PRUint16)atoi(optstate->value); break; case 'q': pingServerFirst = PR_TRUE; break; @@ -597,8 +596,8 @@ int main(int argc, char **argv) if (optstatus == PL_OPT_BAD) Usage(progName); - if (!host || !port) Usage(progName); - portno = (PRUint16)atoi(port); + if (!host || !portno) + Usage(progName); if (!certDir) { certDir = SECU_DefaultSSLDir(); /* Look in $SSL_DIR */ @@ -1039,6 +1038,9 @@ int main(int argc, char **argv) } done: + PORT_Free(nickname); + PORT_Free(password); + PORT_Free(host); PR_Close(s); SSL_ClearSessionCache(); if (NSS_Shutdown() != SECSuccess) { |