summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/control.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-08-20 18:18:17 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-08-20 18:18:17 +0000
commit0363e76fca88c7afec52ccc92b95aa7104315ea3 (patch)
tree9f5338bef1cbccc8df324b594b263bb7b5673dfd /usr.sbin/smtpd/control.c
parentc512cdc0a183be6870310ed47f0cf68659524433 (diff)
Do not send more bytes than necessary with IMSG_STAT_*. The INCREMENT
and DECREMENT messages just contain the key with the ending zero. For IMSG_STAT_SET, the value is found at the beginning of the message, and the rest is the key. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/control.c')
-rw-r--r--usr.sbin/smtpd/control.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c
index 969a437e7cb..cf7ba541262 100644
--- a/usr.sbin/smtpd/control.c
+++ b/usr.sbin/smtpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.68 2012/08/18 18:18:23 gilles Exp $ */
+/* $OpenBSD: control.c,v 1.69 2012/08/20 18:18:16 eric Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -71,7 +71,7 @@ control_imsg(struct imsgev *iev, struct imsg *imsg)
{
struct ctl_conn *c;
char *key;
- struct stat_kv *stat_kv;
+ size_t val;
log_imsg(PROC_CONTROL, iev->proc, imsg);
@@ -99,9 +99,10 @@ control_imsg(struct imsgev *iev, struct imsg *imsg)
stat_backend->decrement(key);
return;
case IMSG_STAT_SET:
- stat_kv = (struct stat_kv *)imsg->data;
+ memmove(&val, imsg->data, sizeof (val));
+ key = (char*)imsg->data + sizeof (val);
if (stat_backend)
- stat_backend->set(stat_kv->key, stat_kv->val);
+ stat_backend->set(key, val);
return;
}