summaryrefslogtreecommitdiff
path: root/usr.bin/openssl
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-03 03:24:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-03 03:24:05 +0000
commit75fca2aa3a35362ecff27f0c3041d3f511b51275 (patch)
treed0c647e96313c8d94edf3f50304b78ae1cf249c1 /usr.bin/openssl
parentaef6c060ee15355c0490999de3c4679d7bb97e84 (diff)
snprintf/vsnprintf return < 0 on error, rather than -1.
Diffstat (limited to 'usr.bin/openssl')
-rw-r--r--usr.bin/openssl/apps.c4
-rw-r--r--usr.bin/openssl/ca.c4
-rw-r--r--usr.bin/openssl/req.c18
-rw-r--r--usr.bin/openssl/s_time.c4
4 files changed, 15 insertions, 15 deletions
diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c
index 47e21265af2..39ce7a5f342 100644
--- a/usr.bin/openssl/apps.c
+++ b/usr.bin/openssl/apps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apps.c,v 1.52 2019/06/28 13:35:02 deraadt Exp $ */
+/* $OpenBSD: apps.c,v 1.53 2019/07/03 03:24:02 deraadt Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -1328,7 +1328,7 @@ save_serial(char *serialfile, char *suffix, BIGNUM *serial,
else
n = snprintf(serialpath, sizeof serialpath, "%s.%s",
serialfile, suffix);
- if (n == -1 || n >= sizeof(serialpath)) {
+ if (n < 0 || n >= sizeof(serialpath)) {
BIO_printf(bio_err, "serial too long\n");
goto err;
}
diff --git a/usr.bin/openssl/ca.c b/usr.bin/openssl/ca.c
index 2e798495723..ac183f28bf8 100644
--- a/usr.bin/openssl/ca.c
+++ b/usr.bin/openssl/ca.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ca.c,v 1.26 2018/02/07 05:47:55 jsing Exp $ */
+/* $OpenBSD: ca.c,v 1.27 2019/07/03 03:24:02 deraadt Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1109,7 +1109,7 @@ ca_main(int argc, char **argv)
k = snprintf(pempath, sizeof(pempath),
"%s/%s.pem", outdir, serialstr);
free(serialstr);
- if (k == -1 || k >= sizeof(pempath)) {
+ if (k < 0 || k >= sizeof(pempath)) {
BIO_printf(bio_err,
"certificate file name too long\n");
goto err;
diff --git a/usr.bin/openssl/req.c b/usr.bin/openssl/req.c
index c5cae4df897..6b7dfb98b98 100644
--- a/usr.bin/openssl/req.c
+++ b/usr.bin/openssl/req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: req.c,v 1.15 2018/02/07 05:47:55 jsing Exp $ */
+/* $OpenBSD: req.c,v 1.16 2019/07/03 03:24:02 deraadt Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1030,7 +1030,7 @@ prompt_info(X509_REQ * req,
if ((nid = OBJ_txt2nid(type)) == NID_undef)
goto start;
ret = snprintf(buf, sizeof buf, "%s_default", v->name);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for default\n",
v->name);
return 0;
@@ -1040,7 +1040,7 @@ prompt_info(X509_REQ * req,
def = "";
}
ret = snprintf(buf, sizeof buf, "%s_value", v->name);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for value\n",
v->name);
return 0;
@@ -1050,7 +1050,7 @@ prompt_info(X509_REQ * req,
value = NULL;
}
ret = snprintf(buf, sizeof buf, "%s_min", v->name);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for min\n",
v->name);
return 0;
@@ -1060,7 +1060,7 @@ prompt_info(X509_REQ * req,
n_min = -1;
}
ret = snprintf(buf, sizeof buf, "%s_max", v->name);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for max\n",
v->name);
return 0;
@@ -1098,7 +1098,7 @@ start2: for (;;) {
if ((nid = OBJ_txt2nid(type)) == NID_undef)
goto start2;
ret = snprintf(buf, sizeof buf, "%s_default", type);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for default\n",
v->name);
return 0;
@@ -1109,7 +1109,7 @@ start2: for (;;) {
def = "";
}
ret = snprintf(buf, sizeof buf, "%s_value", type);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for value\n",
v->name);
return 0;
@@ -1120,7 +1120,7 @@ start2: for (;;) {
value = NULL;
}
ret = snprintf(buf, sizeof buf, "%s_min", type);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for min\n",
v->name);
return 0;
@@ -1130,7 +1130,7 @@ start2: for (;;) {
n_min = -1;
}
ret = snprintf(buf, sizeof buf, "%s_max", type);
- if (ret == -1 || ret >= sizeof(buf)) {
+ if (ret < 0 || ret >= sizeof(buf)) {
BIO_printf(bio_err, "Name '%s' too long for max\n",
v->name);
return 0;
diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c
index 1506ca356ac..3263a2dff36 100644
--- a/usr.bin/openssl/s_time.c
+++ b/usr.bin/openssl/s_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_time.c,v 1.32 2018/09/17 15:37:35 cheloha Exp $ */
+/* $OpenBSD: s_time.c,v 1.33 2019/07/03 03:24:02 deraadt Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -377,7 +377,7 @@ run_test(SSL *scon)
if (s_time_config.www_path != NULL) {
retval = snprintf(buf, sizeof buf,
"GET %s HTTP/1.0\r\n\r\n", s_time_config.www_path);
- if (retval == -1 || retval >= sizeof buf) {
+ if (retval < 0 || retval >= sizeof buf) {
fprintf(stderr, "URL too long\n");
return 0;
}