diff options
| author | Greg Hudson <ghudson@mit.edu> | 2008-11-05 16:19:01 +0000 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2008-11-05 16:19:01 +0000 |
| commit | 6d38cab0b686e49b3a72e02e29099cd491e052cb (patch) | |
| tree | 0095bfb30797e75bef5d6e4c01b4586a48e1cbfb /src/plugins/preauth | |
| parent | 6566763d0c306ad4dca003f2c4b9dd354d3d14fb (diff) | |
| download | krb5-6d38cab0b686e49b3a72e02e29099cd491e052cb.tar.gz krb5-6d38cab0b686e49b3a72e02e29099cd491e052cb.tar.xz krb5-6d38cab0b686e49b3a72e02e29099cd491e052cb.zip | |
Convert many uses of strcpy/strcat (and sometimes sprintf) to accepted
string-handling functions.
ticket: 6200
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21001 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/plugins/preauth')
| -rw-r--r-- | src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c index 2ab23b03a..2c1ec38a7 100644 --- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c +++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c @@ -3200,6 +3200,7 @@ pkinit_login(krb5_context context, { krb5_data rdat; char *prompt; + const char *warning; krb5_prompt kprompt; krb5_prompt_type prompt_type; int r = 0; @@ -3208,15 +3209,17 @@ pkinit_login(krb5_context context, rdat.data = NULL; rdat.length = 0; } else { - if ((prompt = (char *) malloc(sizeof (tip->label) + 32)) == NULL) - return ENOMEM; - sprintf(prompt, "%.*s PIN", sizeof (tip->label), tip->label); if (tip->flags & CKF_USER_PIN_LOCKED) - strcat(prompt, " (Warning: PIN locked)"); + warning = " (Warning: PIN locked)"; else if (tip->flags & CKF_USER_PIN_FINAL_TRY) - strcat(prompt, " (Warning: PIN final try)"); + warning = " (Warning: PIN final try)"; else if (tip->flags & CKF_USER_PIN_COUNT_LOW) - strcat(prompt, " (Warning: PIN count low)"); + warning = " (Warning: PIN count low)"; + else + warning = ""; + if (asprintf(&prompt, "%.*s PIN%s", (int) sizeof (tip->label), + tip->label, warning) < 0) + return ENOMEM; rdat.data = (char *)malloc(tip->ulMaxPinLen + 2); rdat.length = tip->ulMaxPinLen + 1; |
