summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldapd
diff options
context:
space:
mode:
authorrob <rob@openbsd.org>2018-07-13 08:30:10 +0000
committerrob <rob@openbsd.org>2018-07-13 08:30:10 +0000
commit1b679b9b306484cbb0dd7005eff2ecf870a8f88d (patch)
treee5bdd1e7e6615436fe617ef78728f6c9154d4bc0 /usr.sbin/ldapd
parentMove aspath_verify() and aspath_inflate() into util.c so bgpctl can use them. (diff)
downloadwireguard-openbsd-1b679b9b306484cbb0dd7005eff2ecf870a8f88d.tar.xz
wireguard-openbsd-1b679b9b306484cbb0dd7005eff2ecf870a8f88d.zip
Fix loop condition in ber.c. Discussed with claudio.
ok claudio@, jca@
Diffstat (limited to 'usr.sbin/ldapd')
-rw-r--r--usr.sbin/ldapd/ber.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.sbin/ldapd/ber.c b/usr.sbin/ldapd/ber.c
index 65c952b1137..0b955b3271f 100644
--- a/usr.sbin/ldapd/ber.c
+++ b/usr.sbin/ldapd/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.22 2018/07/09 09:21:26 jca Exp $ */
+/* $OpenBSD: ber.c,v 1.23 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;
}