Extend the index parameter checking from sk_value to sk_set(). Also tidy up
[openssl.git] / apps / pkcs12.c
index dd56a2b808ab76dbb548102439ffc0bd9ec65f98..dd0d29bfaad48b9d369dc7b2a11a8f1a4ce46eb8 100644 (file)
@@ -551,14 +551,14 @@ int MAIN(int argc, char **argv)
                BIO_printf (bio_err, "Can't read Password\n");
                goto export_end;
                }
-       if (!twopass) strcpy(macpass, pass);
+       if (!twopass) BUF_strlcpy(macpass, pass, sizeof macpass);
 
 #ifdef CRYPTO_MDEBUG
        CRYPTO_pop_info();
        CRYPTO_push_info("creating PKCS#12 structure");
 #endif
 
-       p12 = PKCS12_create(pass, name, key, ucert, certs,
+       p12 = PKCS12_create(cpass, name, key, ucert, certs,
                                key_pbe, cert_pbe, iter, -1, keytype);
 
        if (!p12)
@@ -613,7 +613,7 @@ int MAIN(int argc, char **argv)
     CRYPTO_pop_info();
 #endif
 
-    if (!twopass) strcpy(macpass, pass);
+    if (!twopass) BUF_strlcpy(macpass, pass, sizeof macpass);
 
     if (options & INFO) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
     if(macver) {
@@ -811,11 +811,12 @@ err:
 int alg_print (BIO *x, X509_ALGOR *alg)
 {
        PBEPARAM *pbe;
-       unsigned char *p;
+       const unsigned char *p;
        p = alg->parameter->value.sequence->data;
        pbe = d2i_PBEPARAM (NULL, &p, alg->parameter->value.sequence->length);
-       BIO_printf (bio_err, "%s, Iteration %d\n", 
-       OBJ_nid2ln(OBJ_obj2nid(alg->algorithm)), ASN1_INTEGER_get(pbe->iter));
+       BIO_printf (bio_err, "%s, Iteration %ld\n", 
+               OBJ_nid2ln(OBJ_obj2nid(alg->algorithm)),
+               ASN1_INTEGER_get(pbe->iter));
        PBEPARAM_free (pbe);
        return 0;
 }