diff options
| author | Greg Hudson <ghudson@mit.edu> | 2008-10-30 19:32:50 +0000 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2008-10-30 19:32:50 +0000 |
| commit | 5a36d207b1e79b53cd0e440e5b5229148ad23772 (patch) | |
| tree | c149eb4199a310d1bca2c18271c9ab9f222c4bc1 /src/lib/crypto | |
| parent | 131ac802ba0975a047c72f010657f3200b9a2be5 (diff) | |
Use the k5buf module instead of strcpy/strcat in several places
ticket: 6200
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20941 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto')
| -rw-r--r-- | src/lib/crypto/t_hmac.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/crypto/t_hmac.c b/src/lib/crypto/t_hmac.c index 000e64b85..63b90c76f 100644 --- a/src/lib/crypto/t_hmac.c +++ b/src/lib/crypto/t_hmac.c @@ -135,6 +135,7 @@ static void test_hmac() krb5_error_code err; int i, j; int lose = 0; + struct k5buf buf; /* RFC 2202 test vector. */ static const struct hmac_test md5tests[] = { @@ -240,11 +241,12 @@ static void test_hmac() exit(1); } - if (sizeof(stroutbuf) - 3 < 2 * out.length) - abort(); - strcpy(stroutbuf, "0x"); + krb5int_buf_init_fixed(&buf, stroutbuf, sizeof(stroutbuf)); + krb5int_buf_add(&buf, "0x"); for (j = 0; j < out.length; j++) - sprintf(stroutbuf + strlen(stroutbuf), "%02x", 0xff & outbuf[j]); + krb5int_buf_add_fmt(&buf, "%02x", 0xff & outbuf[j]); + if (krb5int_buf_cstr(&buf) == NULL) + abort(); if (strcmp(stroutbuf, md5tests[i].hexdigest)) { printf("*** CHECK FAILED!\n" "\tReturned: %s.\n" |
