From: job Date: Sun, 27 Nov 2022 20:50:09 +0000 (+0000) Subject: BIO_puts return values can be ambiguous, improve the check X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5d47d88e15d82dd8366654ceb573f7701d3c5575;p=openbsd BIO_puts return values can be ambiguous, improve the check OK tb@ --- 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 * Copyright (c) 2019 Kristaps Dzonsons @@ -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; }