diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-07-03 03:24:05 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-07-03 03:24:05 +0000 |
commit | 75fca2aa3a35362ecff27f0c3041d3f511b51275 (patch) | |
tree | d0c647e96313c8d94edf3f50304b78ae1cf249c1 /lib/libc/asr | |
parent | aef6c060ee15355c0490999de3c4679d7bb97e84 (diff) |
snprintf/vsnprintf return < 0 on error, rather than -1.
Diffstat (limited to 'lib/libc/asr')
-rw-r--r-- | lib/libc/asr/asr_debug.c | 4 | ||||
-rw-r--r-- | lib/libc/asr/getnameinfo.c | 4 | ||||
-rw-r--r-- | lib/libc/asr/getnameinfo_async.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/asr/asr_debug.c b/lib/libc/asr/asr_debug.c index 141517b8360..9fc5857ebde 100644 --- a/lib/libc/asr/asr_debug.c +++ b/lib/libc/asr/asr_debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr_debug.c,v 1.25 2018/04/28 15:16:49 schwarze Exp $ */ +/* $OpenBSD: asr_debug.c,v 1.26 2019/07/03 03:24:03 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -73,7 +73,7 @@ print_rr(const struct asr_dns_rr *rr, char *buf, size_t max) rr->rr_ttl, __p_class(rr->rr_class), __p_type(rr->rr_type)); - if (r == -1) { + if (r < 0 || r >= max) { buf[0] = '\0'; return (buf); } diff --git a/lib/libc/asr/getnameinfo.c b/lib/libc/asr/getnameinfo.c index a61b542e08c..7bee468dbc0 100644 --- a/lib/libc/asr/getnameinfo.c +++ b/lib/libc/asr/getnameinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnameinfo.c,v 1.8 2015/10/02 20:56:14 deraadt Exp $ */ +/* $OpenBSD: getnameinfo.c,v 1.9 2019/07/03 03:24:03 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -138,7 +138,7 @@ asr_print_port(const struct sockaddr *sa, const char *proto, char *buf, size_t b } r = snprintf(buf, buflen, "%u", ntohs(port)); - if (r == -1) /* Actually, this can not happen */ + if (r < 0 || r >= buflen) /* Actually, this can not happen */ return (0); return (r); diff --git a/lib/libc/asr/getnameinfo_async.c b/lib/libc/asr/getnameinfo_async.c index 93d9a2dbea9..13c00f1c7a1 100644 --- a/lib/libc/asr/getnameinfo_async.c +++ b/lib/libc/asr/getnameinfo_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnameinfo_async.c,v 1.13 2017/02/23 17:04:02 eric Exp $ */ +/* $OpenBSD: getnameinfo_async.c,v 1.14 2019/07/03 03:24:03 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -235,7 +235,7 @@ _servname(struct asr_query *as) } r = snprintf(buf, buflen, "%u", ntohs(port)); - if (r == -1 || r >= (int)buflen) + if (r < 0 || r >= buflen) return (-1); return (0); |