I missed an argc check which causes snmp trap to segfault if called with too few arguments instead of showing usage.
OK? martijn@ Index: snmpc.c =================================================================== RCS file: /cvs/src/usr.bin/snmp/snmpc.c,v retrieving revision 1.30 diff -u -p -r1.30 snmpc.c --- snmpc.c 14 Sep 2020 15:12:27 -0000 1.30 +++ snmpc.c 30 Nov 2020 16:25:24 -0000 @@ -788,6 +788,9 @@ snmpc_trap(int argc, char *argv[]) if (version == SNMP_V1) errx(1, "trap is not supported for snmp v1"); + if (argc < 3) + usage(); + if ((agent = snmpc_connect(argv[0], "162")) == NULL) err(1, "%s", snmp_app->name);