summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJob Snijders <job@cvs.openbsd.org>2022-11-27 20:50:10 +0000
committerJob Snijders <job@cvs.openbsd.org>2022-11-27 20:50:10 +0000
commit769457a76e049a85773347324f88d5cc4de5d160 (patch)
tree1bb4932367341e055711dd7fd2592365e94bcba6
parent1e4f62d91cbf1f8b3eb9afb073b04652d66b15c8 (diff)
BIO_puts return values can be ambiguous, improve the check
OK tb@
-rw-r--r--usr.sbin/rpki-client/geofeed.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/rpki-client/geofeed.c b/usr.sbin/rpki-client/geofeed.c
index e4a86dac8b7..4c465315ec3 100644
--- a/usr.sbin/rpki-client/geofeed.c
+++ b/usr.sbin/rpki-client/geofeed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: geofeed.c,v 1.5 2022/11/26 23:05:22 tb Exp $ */
+/* $OpenBSD: geofeed.c,v 1.6 2022/11/27 20:50:09 job Exp $ */
/*
* Copyright (c) 2022 Job Snijders <job@fastly.com>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -101,7 +101,7 @@ geofeed_parse(X509 **x509, const char *fn, char *buf, size_t len)
{
struct parse p;
char *delim, *line, *loc, *nl;
- size_t linelen;
+ int linelen;
BIO *bio;
char *b64 = NULL;
size_t b64sz;
@@ -186,7 +186,8 @@ geofeed_parse(X509 **x509, const char *fn, char *buf, size_t len)
* calculate the message digest and compare with the one
* in the detached CMS signature.
*/
- if (BIO_puts(bio, line) <= 0 || BIO_puts(bio, "\r\n") <= 0) {
+ if (BIO_puts(bio, line) != linelen ||
+ BIO_puts(bio, "\r\n") != 2) {
warnx("%s: BIO_puts failed", fn);
goto out;
}