summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorderaadt <>2019-07-03 03:24:04 +0000
committerderaadt <>2019-07-03 03:24:04 +0000
commitef84a12d8fc3f2dacb57102d5f84bfb4025a320a (patch)
tree095ed8468464d046dbf7618376c0a18af76dceba /src/lib
parent88ab3711341dea97a3118b0654ceab1679d5e0a1 (diff)
downloadopenbsd-ef84a12d8fc3f2dacb57102d5f84bfb4025a320a.tar.gz
openbsd-ef84a12d8fc3f2dacb57102d5f84bfb4025a320a.tar.bz2
openbsd-ef84a12d8fc3f2dacb57102d5f84bfb4025a320a.zip
snprintf/vsnprintf return < 0 on error, rather than -1.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/net/inet_net_ntop.c4
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c6
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_sign.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libc/net/inet_net_ntop.c b/src/lib/libc/net/inet_net_ntop.c
index 652b24076e..1f1c4bed12 100644
--- a/src/lib/libc/net/inet_net_ntop.c
+++ b/src/lib/libc/net/inet_net_ntop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_net_ntop.c,v 1.8 2015/05/14 11:52:43 jsg Exp $ */ 1/* $OpenBSD: inet_net_ntop.c,v 1.9 2019/07/03 03:24:04 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2012 by Gilles Chehade <gilles@openbsd.org> 4 * Copyright (c) 2012 by Gilles Chehade <gilles@openbsd.org>
@@ -151,7 +151,7 @@ inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size)
151 return (NULL); 151 return (NULL);
152 152
153 ret = snprintf(dst, size, "%s/%d", buf, bits); 153 ret = snprintf(dst, size, "%s/%d", buf, bits);
154 if (ret == -1 || ret >= size) { 154 if (ret < 0 || ret >= size) {
155 errno = EMSGSIZE; 155 errno = EMSGSIZE;
156 return (NULL); 156 return (NULL);
157 } 157 }
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c
index 6c50aa980a..c0b63e4d85 100644
--- a/src/lib/libcrypto/objects/obj_dat.c
+++ b/src/lib/libcrypto/objects/obj_dat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: obj_dat.c,v 1.41 2018/09/08 13:49:26 tb Exp $ */ 1/* $OpenBSD: obj_dat.c,v 1.42 2019/07/03 03:24:04 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -608,7 +608,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
608 goto err; 608 goto err;
609 i = snprintf(buf, buf_len, ".%s", bndec); 609 i = snprintf(buf, buf_len, ".%s", bndec);
610 free(bndec); 610 free(bndec);
611 if (i == -1) 611 if (i < 0)
612 goto err; 612 goto err;
613 if (i >= buf_len) { 613 if (i >= buf_len) {
614 buf_len = 0; 614 buf_len = 0;
@@ -619,7 +619,7 @@ OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
619 ret += i; 619 ret += i;
620 } else { 620 } else {
621 i = snprintf(buf, buf_len, ".%lu", l); 621 i = snprintf(buf, buf_len, ".%lu", l);
622 if (i == -1) 622 if (i < 0)
623 goto err; 623 goto err;
624 if (i >= buf_len) { 624 if (i >= buf_len) {
625 buf_len = 0; 625 buf_len = 0;
diff --git a/src/lib/libcrypto/ts/ts_rsp_sign.c b/src/lib/libcrypto/ts/ts_rsp_sign.c
index 9ab80160b3..6125fdd4be 100644
--- a/src/lib/libcrypto/ts/ts_rsp_sign.c
+++ b/src/lib/libcrypto/ts/ts_rsp_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_rsp_sign.c,v 1.22 2018/05/13 15:04:05 tb Exp $ */ 1/* $OpenBSD: ts_rsp_sign.c,v 1.23 2019/07/03 03:24:04 deraadt Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -1001,7 +1001,7 @@ TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time,
1001 "%04d%02d%02d%02d%02d%02d%sZ", 1001 "%04d%02d%02d%02d%02d%02d%sZ",
1002 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, 1002 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
1003 tm->tm_hour, tm->tm_min, tm->tm_sec, usecstr); 1003 tm->tm_hour, tm->tm_min, tm->tm_sec, usecstr);
1004 if (rv == -1 || rv >= sizeof(genTime_str)) 1004 if (rv < 0 || rv >= sizeof(genTime_str))
1005 goto err; 1005 goto err;
1006 1006
1007 /* Now call OpenSSL to check and set our genTime value */ 1007 /* Now call OpenSSL to check and set our genTime value */