summaryrefslogtreecommitdiffstats
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
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@
-rw-r--r--usr.bin/ldap/ber.c11
-rw-r--r--usr.sbin/ldapd/ber.c11
-rw-r--r--usr.sbin/snmpd/ber.c11
-rw-r--r--usr.sbin/ypldap/ber.c11
4 files changed, 20 insertions, 24 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;
}
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;
}
diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c
index a760edd8fde..7a966e6679f 100644
--- a/usr.sbin/snmpd/ber.c
+++ b/usr.sbin/snmpd/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.41 2018/07/09 09:21:26 jca Exp $ */
+/* $OpenBSD: ber.c,v 1.42 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;
}
diff --git a/usr.sbin/ypldap/ber.c b/usr.sbin/ypldap/ber.c
index c2696f24e3c..fc714e0aa75 100644
--- a/usr.sbin/ypldap/ber.c
+++ b/usr.sbin/ypldap/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.24 2018/07/09 09:21:26 jca Exp $ */
+/* $OpenBSD: ber.c,v 1.25 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;
}