diff options
author | Gerhard Roth <gerhard@cvs.openbsd.org> | 2023-05-08 12:25:24 +0000 |
---|---|---|
committer | Gerhard Roth <gerhard@cvs.openbsd.org> | 2023-05-08 12:25:24 +0000 |
commit | edb99a142c736a9b37739acba91170c74de7581d (patch) | |
tree | 4bc50a33228b812037ffffdf70a99d594a4fe523 | |
parent | 2779516b58a71a14455a7ef2637ea8dc8e2c259d (diff) |
Fix a potential mem-leak in usm_decrypt().
Spotted by hshoexer@
ok martijn@
-rw-r--r-- | usr.sbin/snmpd/usm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/snmpd/usm.c b/usr.sbin/snmpd/usm.c index 1ced2fdb432..a3df1ac0f31 100644 --- a/usr.sbin/snmpd/usm.c +++ b/usr.sbin/snmpd/usm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usm.c,v 1.25 2022/12/20 20:01:25 martijn Exp $ */ +/* $OpenBSD: usm.c,v 1.26 2023/05/08 12:25:23 gerhard Exp $ */ /* * Copyright (c) 2012 GeNUA mbH @@ -629,8 +629,10 @@ usm_decrypt(struct snmp_message *msg, struct ber_element *encr) return NULL; scoped_pdu_len = usm_crypt(msg, privstr, (int)privlen, buf, 0); - if (scoped_pdu_len < 0) + if (scoped_pdu_len < 0) { + free(buf); return NULL; + } bzero(&ber, sizeof(ber)); ober_set_application(&ber, smi_application); |