Crash from iked config parser with an invalid 'config' keyword.
Example config:
ikev2 "roadwarrior" esp \
from 123.123.123.123/32 to 0.0.0.0/0 \
peer 0.0.0.0/0 local 123.123.123.123 \
srcid 123.123.123.123 \
config address 123.123.123.100 \
config netmask 255.255.255.248 \
config nameserver 123.123.123.1 \
psk "you-should-not-use-psk-authentication!"
Notice 'nameserver' instead of 'name-server'. Seems any incorrect
keyword value after config triggers the crash.
(gdb) set args -nf /etc/iked.conf-crash
(gdb) run
Starting program: /sbin/iked -nf /etc/iked.conf-crash
[New process 997]
Program received signal SIGSEGV, Segmentation fault.
strncmp (s1=0x87f3c413140 "nameserver", s2=0x1000003a9 <Address
0x1000003a9 out of bounds>, n=10) at
/usr/src/lib/libc/string/strncmp.c:41
41 if (*s1 != *s2++)
(gdb) bt
#0 strncmp (s1=0x87f3c413140 "nameserver", s2=0x1000003a9 <Address
0x1000003a9 out of bounds>, n=10) at
/usr/src/lib/libc/string/strncmp.c:41
#1 0x0000087d07f5ff5e in parse_xf (name=0x87f3c413140 "nameserver",
length=2, xfs=0x87d082c8120) at parse.y:2120
#2 0x0000087d07f64923 in yyparse () at parse.y:487
#3 0x0000087d07f655a2 in parse_config (filename=0x87f7af32560
"/etc/iked.conf-crash", x_env=Variable "x_env" is not available.
) at parse.y:1473
#4 0x0000087d07f3f755 in parent_configure (env=0x87f7af32560) at
/usr/src/sbin/iked/iked.c:188
#5 0x0000087d07f3fd8d in main (argc=Variable "argc" is not available.
) at /usr/src/sbin/iked/iked.c:173
I am running:
OpenBSD 5.7-current (GENERIC.MP) #3: Sun Jun 14 19:26:47 CDT 2015
r...@bsdedi.kagu-tsuchi.com:/usr/src/sys/arch/amd64/compile/GENERIC.MP
But with the iked code as of July 03.