diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-05-27 04:37:26 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-05-27 04:37:26 +0000 |
commit | c6d5da41fd4f24204e93860f6c5fd537a28e87d5 (patch) | |
tree | 34deef9a06860c391c7faa9fba8c43853620eb01 /sbin/isakmpd | |
parent | 0201d4dbc7eb6bd7082ac2ddfc3bd3d09030c58f (diff) |
guarantee nul-termination in the monitor, we must. ok cloder@ hshoexer@
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/monitor.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c index b43b9516494..fffd7ec482f 100644 --- a/sbin/isakmpd/monitor.c +++ b/sbin/isakmpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.50 2005/05/26 22:22:03 hshoexer Exp $ */ +/* $OpenBSD: monitor.c,v 1.51 2005/05/27 04:37:25 moritz Exp $ */ /* * Copyright (c) 2003 Håkan Olsson. All rights reserved. @@ -219,7 +219,7 @@ monitor_open(const char *path, int flags, mode_t mode) cmd = MONITOR_GET_FD; must_write(m_state.s, &cmd, sizeof cmd); - len = strlen(pathreal) + 1; + len = strlen(pathreal); must_write(m_state.s, &len, sizeof len); must_write(m_state.s, &pathreal, len); @@ -649,10 +649,11 @@ m_priv_getfd(int s) mode_t mode; must_read(s, &len, sizeof len); - if (len <= 0 || sizeof path < len) + if (len <= 0 || len >= sizeof path) log_fatal("m_priv_getfd: invalid pathname length"); must_read(s, path, len); + path[len] = '\0'; must_read(s, &flags, sizeof flags); must_read(s, &mode, sizeof mode); |