summaryrefslogtreecommitdiff
path: root/usr.bin/ldap
diff options
context:
space:
mode:
authorrob <rob@cvs.openbsd.org>2018-07-13 08:30:11 +0000
committerrob <rob@cvs.openbsd.org>2018-07-13 08:30:11 +0000
commit868ec0e8bed6aec257096afd5b610496c83fe0aa (patch)
tree3676bcf1444fcb70e57df0c57ead53786bcf2e31 /usr.bin/ldap
parentd6282736231a6aca89328f6166919023d2ebef88 (diff)
Fix loop condition in ber.c. Discussed with claudio.
ok claudio@, jca@
Diffstat (limited to 'usr.bin/ldap')
-rw-r--r--usr.bin/ldap/ber.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/ldap/ber.c b/usr.bin/ldap/ber.c
index ffdafb263cb..47f0880407a 100644
--- a/usr.bin/ldap/ber.c
+++ b/usr.bin/ldap/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.12 2018/07/09 09:21:26 jca Exp $ */
+/* $OpenBSD: ber.c,v 1.13 2018/07/13 08:30:10 rob Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -1032,13 +1032,12 @@ get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
return -1;
t = (t << 7) | (u & ~BER_TAG_MORE);
i++;
+ if (i > sizeof(unsigned long)) {
+ errno = ERANGE;
+ return -1;
+ }
} while (u & BER_TAG_MORE);
- if (i > sizeof(unsigned long)) {
- errno = ERANGE;
- return -1;
- }
-
*tag = t;
return i + 1;
}