diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-07-07 19:29:25 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-07-07 19:29:25 +0000 |
commit | eb589c99a0f8208131cae389b90793f3d138a94e (patch) | |
tree | 96dc4d02333eb7d46716d82603d7a72574b5abc1 /usr.sbin/sasyncd | |
parent | 79d18ee9548dc0ec3869348f45d5c9ab9cceaec3 (diff) |
when reading of sadb/spd data fails don't call
memset with a len of (unsigned)-1. ok ho@
Diffstat (limited to 'usr.sbin/sasyncd')
-rw-r--r-- | usr.sbin/sasyncd/monitor.c | 11 |
1 files changed, 6 insertions, 5 deletions
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. */ |