From 43496f5abc1b87305c8f87f3d38acc3b24349b79 Mon Sep 17 00:00:00 2001 From: sashan Date: Wed, 9 Feb 2022 11:42:58 +0000 Subject: [PATCH] let pfattach() to also initialize pf_default_rule_new to avoid div-by-zero in pf_purge() Reported-by: syzbot+e720e3bab51366d7b667@syzkaller.appspotmail.com OK deraadt@ --- sys/net/pf_ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index fa2a5dcdb64..124cf7e420a 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.371 2022/01/24 22:49:48 bluhm Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.372 2022/02/09 11:42:58 sashan Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -250,6 +250,8 @@ pfattach(int num) /* XXX do our best to avoid a conflict */ pf_status.hostid = arc4random(); + + pf_default_rule_new = pf_default_rule; } int -- 2.20.1