summaryrefslogtreecommitdiff
path: root/lib/libutil/ber.c
diff options
context:
space:
mode:
authorrob <rob@cvs.openbsd.org>2021-01-22 18:27:53 +0000
committerrob <rob@cvs.openbsd.org>2021-01-22 18:27:53 +0000
commitf8fe3070cac839f2df26356a22f41b38716174e1 (patch)
tree5a758f25ac1b77c56c7d80670a403c2d043370bd /lib/libutil/ber.c
parent8b3b1365c98ea1eccb601c4280e280e9f0bf94a8 (diff)
Gracefully handle any erroneous closing bracket/brace trailers in
ober_scanf_elements(). OK martijn@
Diffstat (limited to 'lib/libutil/ber.c')
-rw-r--r--lib/libutil/ber.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libutil/ber.c b/lib/libutil/ber.c
index 9768ed3b82a..11f8952a9c0 100644
--- a/lib/libutil/ber.c
+++ b/lib/libutil/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.18 2021/01/22 03:20:56 rob Exp $ */
+/* $OpenBSD: ber.c,v 1.19 2021/01/22 18:27:52 rob Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -781,7 +781,7 @@ ober_scanf_elements(struct ber_element *ber, char *fmt, ...)
continue;
case '}':
case ')':
- if (parent[level] == NULL)
+ if (level < 0 || parent[level] == NULL)
goto fail;
ber = parent[level--];
ret++;