diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2021-12-13 19:47:41 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2021-12-13 19:47:41 +0000 |
commit | 32242f7624aa1fa235dfa1c6531492bd77a306a5 (patch) | |
tree | da5a24620c95bf5659c42fe3a371cef7dc55ee37 /sbin/iked/ca.c | |
parent | 217e930276c2b29de9559d6952555e75a3a56114 (diff) |
Fix asprintf() error check. Portable code should check the return
value for -1, not buf == NULL.
ok tobhe
Diffstat (limited to 'sbin/iked/ca.c')
-rw-r--r-- | sbin/iked/ca.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/iked/ca.c b/sbin/iked/ca.c index e1d457f8935..4c8ec89d1c4 100644 --- a/sbin/iked/ca.c +++ b/sbin/iked/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.85 2021/12/13 19:46:22 tb Exp $ */ +/* $OpenBSD: ca.c,v 1.86 2021/12/13 19:47:40 tb Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -1133,7 +1133,7 @@ ca_store_info(struct iked *env, const char *msg, X509_STORE *ctx) X509_NAME *subject; char *name; char *buf; - size_t buflen; + int buflen; h = X509_STORE_get0_objects(ctx); for (i = 0; i < sk_X509_OBJECT_num(h); i++) { @@ -1146,7 +1146,7 @@ ca_store_info(struct iked *env, const char *msg, X509_STORE *ctx) continue; buflen = asprintf(&buf, "%s: %s\n", msg, name); free(name); - if (buf == NULL) + if (buflen == -1) continue; proc_compose(&env->sc_ps, PROC_CONTROL, IMSG_CTL_SHOW_CERTSTORE, buf, buflen + 1); |