diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-11-14 23:25:12 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-11-14 23:25:12 +0000 |
commit | a04c4652e5ba0898c079e41e8c159f7b0c0e0ee2 (patch) | |
tree | 44206c8c346bdc99c0c32ce007d7b214f287cabe /sbin/isakmpd/ike_quick_mode.c | |
parent | 0ded5e7dce531b702eb130e741310890f70bffbe (diff) |
use snprintf; ok cloder. also looked at by a few other people
Diffstat (limited to 'sbin/isakmpd/ike_quick_mode.c')
-rw-r--r-- | sbin/isakmpd/ike_quick_mode.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sbin/isakmpd/ike_quick_mode.c b/sbin/isakmpd/ike_quick_mode.c index eb7a576ec8c..b8e71664e32 100644 --- a/sbin/isakmpd/ike_quick_mode.c +++ b/sbin/isakmpd/ike_quick_mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_quick_mode.c,v 1.96 2005/05/26 06:11:09 hshoexer Exp $ */ +/* $OpenBSD: ike_quick_mode.c,v 1.97 2005/11/14 23:25:11 deraadt Exp $ */ /* $EOM: ike_quick_mode.c,v 1.139 2001/01/26 10:43:17 niklas Exp $ */ /* @@ -256,14 +256,10 @@ check_policy(struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa) "failed to allocate memory for principal"); goto policydone; } - len = strlen(principal[0]) + sizeof "rsa-hex:"; - principal[1] = calloc(len, sizeof(char)); - if (!principal[1]) { - log_error("check_policy: calloc (%d, %lu) failed", len, - (unsigned long)sizeof(char)); + if (asprintf(&principal[1], "rsa-hex:%s", principal[0]) == -1) { + log_error("check_policy: asprintf() failed"); goto policydone; } - snprintf(principal[1], len, "rsa-hex:%s", principal[0]); free(principal[0]); principal[0] = principal[1]; principal[1] = 0; |