summaryrefslogtreecommitdiff
path: root/lib/libkeynote/signature.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-27 06:29:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-27 06:29:15 +0000
commita0af75b22aae2af15d374b505e52fd4ff99ceb59 (patch)
treec34dd869c090e0e5f82255d331c547b9f64dee3c /lib/libkeynote/signature.c
parentbe818a3515d18fe09837751641f46a73b71ca2fa (diff)
snprintf and strlcpy cleanup; angelos ok
Diffstat (limited to 'lib/libkeynote/signature.c')
-rw-r--r--lib/libkeynote/signature.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libkeynote/signature.c b/lib/libkeynote/signature.c
index 5c148f2285c..d3bc73fe8a3 100644
--- a/lib/libkeynote/signature.c
+++ b/lib/libkeynote/signature.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signature.c,v 1.11 2001/09/03 20:14:51 deraadt Exp $ */
+/* $OpenBSD: signature.c,v 1.12 2002/05/27 06:29:14 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -929,6 +929,7 @@ keynote_sign_assertion(struct assertion *as, char *sigalg, void *key,
SHA_CTX shscontext;
MD5_CTX md5context;
#endif /* CRYPTO */
+ int len;
if ((as->as_signature_string_s == (char *) NULL) ||
(as->as_startofsignature == (char *) NULL) ||
@@ -1137,8 +1138,8 @@ keynote_sign_assertion(struct assertion *as, char *sigalg, void *key,
}
/* Replace as->as_signature */
- as->as_signature = (char *) calloc(strlen(sigalg) +
- strlen(finalbuf) + 1, sizeof(char));
+ len = strlen(sigalg) + strlen(finalbuf) + 1;
+ as->as_signature = (char *) calloc(len, sizeof(char));
if (as->as_signature == (char *) NULL)
{
free(finalbuf);
@@ -1147,7 +1148,7 @@ keynote_sign_assertion(struct assertion *as, char *sigalg, void *key,
}
/* Concatenate algorithm name and signature value */
- sprintf(as->as_signature, "%s%s", sigalg, finalbuf);
+ snprintf(as->as_signature, len, "%s%s", sigalg, finalbuf);
free(finalbuf);
finalbuf = as->as_signature;