From eb589c99a0f8208131cae389b90793f3d138a94e Mon Sep 17 00:00:00 2001 From: Moritz Jodeit Date: Thu, 7 Jul 2005 19:29:25 +0000 Subject: when reading of sadb/spd data fails don't call memset with a len of (unsigned)-1. ok ho@ --- usr.sbin/sasyncd/monitor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/sasyncd/monitor.c b/usr.sbin/sasyncd/monitor.c index 496f3b9668c..cc2ba5e5b89 100644 --- a/usr.sbin/sasyncd/monitor.c +++ b/usr.sbin/sasyncd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.4 2005/05/26 19:19:51 ho Exp $ */ +/* $OpenBSD: monitor.c,v 1.5 2005/07/07 19:29:24 moritz Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -175,11 +175,12 @@ int monitor_get_pfkey_snap(u_int8_t **sadb, u_int32_t *sadbsize, u_int8_t **spd, u_int32_t *spdsize) { - u_int32_t rbytes; - + u_int32_t v; + ssize_t rbytes; + /* We write a (any) value to the monitor socket to start a snapshot. */ - rbytes = 0; - if (write(m_state.s, &rbytes, sizeof rbytes) < 1) + v = 0; + if (write(m_state.s, &v, sizeof v) < 1) return -1; /* Read SADB data. */ -- cgit v1.2.3