diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-03-18 14:53:08 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-03-18 14:53:08 +0000 |
commit | 009dcf22dae36690d89ab9d9ba7acb09fdf6c7f1 (patch) | |
tree | b82a45a49d763c903b1787f53035eca53283b169 /usr.sbin | |
parent | ea10e3494de2f1983c562523188c038df7a3e766 (diff) |
fix bug that ber_oid2ber skips the first byte when encoding powers of
128. E.g., it will encode 128 as 0x00 instead of 0x81 0x00.
From Matthew at Dempsky dot org
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/snmpd/ber.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c index 1b761c8eede..5765ab7c0a8 100644 --- a/usr.sbin/snmpd/ber.c +++ b/usr.sbin/snmpd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.12 2008/03/14 15:22:22 reyk Exp $ */ +/* $OpenBSD: ber.c,v 1.13 2008/03/18 14:53:07 reyk Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net> @@ -376,7 +376,7 @@ ber_oid2ber(struct ber_oid *o, u_int8_t *buf, size_t len) v = (o->bo_id[0] * 40) + o->bo_id[1]; for (i = 2, j = 0; i <= o->bo_n; v = o->bo_id[i], i++) { for (k = 28; k >= 7; k -= 7) { - if (v > (u_int)(1 << k)) { + if (v >= (u_int)(1 << k)) { if (len) buf[j] = v >> k | BER_TAG_MORE; j++; |