diff options
author | martijn <martijn@openbsd.org> | 2019-08-14 04:43:32 +0000 |
---|---|---|
committer | martijn <martijn@openbsd.org> | 2019-08-14 04:43:32 +0000 |
commit | 6f562ef8cc39c829f0960866766645a1275c92cc (patch) | |
tree | a8c9d2fea779db4288a45a6bb51c0528f8ec0882 /usr.sbin/snmpd | |
parent | enable amdgpu on amd64 requested by a few people (diff) | |
download | wireguard-openbsd-6f562ef8cc39c829f0960866766645a1275c92cc.tar.xz wireguard-openbsd-6f562ef8cc39c829f0960866766645a1275c92cc.zip |
Fix ber_scanf_elements for traphandler:
- pdu header has 3 elements, not 4
- additional varbinds are optional.
This is needed to make ber_scanf_elements stricter.
Note that people using "trap handle" in their snmpd.conf and expect a trap
without additional varbinds to show the trapoid to appear twice will have
to adjust their "command".
OK rob@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r-- | usr.sbin/snmpd/traphandler.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/snmpd/traphandler.c b/usr.sbin/snmpd/traphandler.c index dfba9e46a7f..c30113c9625 100644 --- a/usr.sbin/snmpd/traphandler.c +++ b/usr.sbin/snmpd/traphandler.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traphandler.c,v 1.13 2019/05/11 17:46:02 rob Exp $ */ +/* $OpenBSD: traphandler.c,v 1.14 2019/08/14 04:43:32 martijn Exp $ */ /* * Copyright (c) 2014 Bret Stephen Lambert <blambert@openbsd.org> @@ -239,10 +239,11 @@ traphandler_parse(char *buf, size_t n, struct ber_element **req, break; case SNMP_V2: - if (ber_scanf_elements(elm, "{SSSS{e}}", &elm) == -1 || - ber_scanf_elements(elm, "{SdS}{So}e", - uptime, trapoid, vbinds) == -1) + if (ber_scanf_elements(elm, "{SSS{e}}", &elm) == -1 || + ber_scanf_elements(elm, "{Sd}{So}", + uptime, trapoid) == -1) goto done; + *vbinds = elm->be_next->be_next; break; default: |