summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2020-09-03 19:09:58 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2020-09-03 19:09:58 +0000
commitc900de3182d6d269438563b8a7643886737132a2 (patch)
treed01de9a3924b9de0751a8d4c9fc61b7ef61f3665
parente4e5a6cd323c6b8c720b412abfa7dba9b308b5f8 (diff)
Missed one case of errno not being set in previous.
double check and OK tb@
-rw-r--r--lib/libutil/ber.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libutil/ber.c b/lib/libutil/ber.c
index d7cc863eaeb..1698aad6147 100644
--- a/lib/libutil/ber.c
+++ b/lib/libutil/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.16 2020/09/03 17:01:15 martijn Exp $ */
+/* $OpenBSD: ber.c,v 1.17 2020/09/03 19:09:57 martijn Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -1258,8 +1258,10 @@ ober_read_element(struct ber *ber, struct ber_element *elm)
}
case BER_TYPE_INTEGER:
case BER_TYPE_ENUMERATED:
- if (len > (ssize_t)sizeof(long long))
+ if (len > (ssize_t)sizeof(long long)) {
+ errno = ERANGE;
return -1;
+ }
for (i = 0; i < len; i++) {
if (ober_getc(ber, &c) != 1)
return -1;