diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2019-10-07 07:39:51 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2019-10-07 07:39:51 +0000 |
commit | 3d78f91f497ab5d16a3b99a1681e36e396532f71 (patch) | |
tree | 87322b44c2395b9749bb36f6c5ae10a5f91723a3 /usr.bin/snmp | |
parent | 91d1e45ebc7bf374b7410fdd6137511aef2b5297 (diff) |
If optstring is NULL and usecommonopt is true, optstr was prepended
by uninitialized garbage. Crash in snmp(1) found by
regress/usr.sbin/snmpd.
OK martijn@
Diffstat (limited to 'usr.bin/snmp')
-rw-r--r-- | usr.bin/snmp/snmpc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/snmp/snmpc.c b/usr.bin/snmp/snmpc.c index 54ab70e2359..6ac181e3bd3 100644 --- a/usr.bin/snmp/snmpc.c +++ b/usr.bin/snmp/snmpc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpc.c,v 1.13 2019/10/03 11:02:26 martijn Exp $ */ +/* $OpenBSD: snmpc.c,v 1.14 2019/10/07 07:39:50 bluhm Exp $ */ /* * Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org> @@ -128,6 +128,7 @@ main(int argc, char *argv[]) if (argc <= 1) usage(); + optstr[0] = '\0'; for (i = 0; i < sizeof(snmp_apps)/sizeof(*snmp_apps); i++) { if (strcmp(snmp_apps[i].name, argv[1]) == 0) { snmp_app = &snmp_apps[i]; |