From 7f4721fbafd18567c06f13dc36e65ba264ff675b Mon Sep 17 00:00:00 2001 From: jsg <> Date: Thu, 20 Nov 2014 05:51:20 +0000 Subject: [PATCH] Don't allow embedded nul characters in strings. Fixes a pfctl crash with an anchor name containing an embedded nul found with the afl fuzzer. pfctl parse.y patch from and ok deraadt@ --- src/usr.sbin/ntpd/parse.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index b5567912..9608c3f6 100644 --- a/src/usr.sbin/ntpd/parse.y +++ b/src/usr.sbin/ntpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.54 2014/11/14 03:20:37 doug Exp $ */ +/* $OpenBSD: parse.y,v 1.55 2014/11/20 05:51:20 jsg Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -520,6 +520,9 @@ yylex(void) } else if (c == quotec) { *p = '\0'; break; + } else if (c == '\0') { + yyerror("syntax error"); + return (findeol()); } if (p + 1 >= buf + sizeof(buf) - 1) { yyerror("string too long");