Browse Source

Enforce minimal number of octets for tag > 30.

"sure" claudio@
OPENBSD_6_6
rob 5 years ago
parent
commit
d7ff82d34b
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      src/lib/libutil/ber.c

+ 8
- 1
src/lib/libutil/ber.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ber.c,v 1.2 2019/05/12 17:42:14 rob Exp $ */
/* $OpenBSD: ber.c,v 1.3 2019/05/12 17:50:32 rob Exp $ */
/* /*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org> * Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@ -1116,6 +1116,13 @@ get_id(struct ber *b, unsigned int *tag, int *class, int *cstruct)
do { do {
if (ber_getc(b, &u) == -1) if (ber_getc(b, &u) == -1)
return -1; return -1;
/* enforce minimal number of octets for tag > 30 */
if (i == 0 && (u & ~BER_TAG_MORE) == 0) {
errno = EINVAL;
return -1;
}
t = (t << 7) | (u & ~BER_TAG_MORE); t = (t << 7) | (u & ~BER_TAG_MORE);
i++; i++;
if (i > sizeof(unsigned int)) { if (i > sizeof(unsigned int)) {


Loading…
Cancel
Save