check to ensure we avoid a possible (undefined) negative shift. Found
with clang static analyzer.
Tweaked and OK martijn@
-/* $OpenBSD: ber.c,v 1.17 2020/09/03 19:09:57 martijn Exp $ */
+/* $OpenBSD: ber.c,v 1.18 2021/01/22 03:20:56 rob Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
}
case BER_TYPE_INTEGER:
case BER_TYPE_ENUMERATED:
+ if (len < 1) {
+ errno = EINVAL;
+ return -1;
+ }
if (len > (ssize_t)sizeof(long long)) {
errno = ERANGE;
return -1;