summaryrefslogtreecommitdiffstats
path: root/server-msg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 13:07:42 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 13:07:42 +0000
commita5a17b40ee9cd25eae3c3d177abf4e4faa2dc4d8 (patch)
treee8d5ecdeda3d963441dada75f5042b5cc40cf3a3 /server-msg.c
parentab6170d6bfafba722a6ce84221dd8b1854f0c742 (diff)
Skip exec on cmds. Also use xmemstrdup where appropriate.
Diffstat (limited to 'server-msg.c')
-rw-r--r--server-msg.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/server-msg.c b/server-msg.c
index c402fc58..6de3d34c 100644
--- a/server-msg.c
+++ b/server-msg.c
@@ -1,4 +1,4 @@
-/* $Id: server-msg.c,v 1.18 2007-10-03 12:34:16 nicm Exp $ */
+/* $Id: server-msg.c,v 1.19 2007-10-03 13:07:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -398,15 +398,9 @@ server_msg_fn_bindkey(struct hdr *hdr, struct client *c)
if (data.flags & BIND_STRING) {
hdr->size -= sizeof data;
- if (hdr->size != 0) {
- str = xmalloc(hdr->size + 1);
- buffer_read(c->in, str, hdr->size);
- str[hdr->size] = '\0';
- }
- if (*str == '\0') {
- xfree(str);
- str = NULL;
- }
+ str = xmemstrdup(BUFFER_OUT(c->in), hdr->size);
+ if (hdr->size > 0)
+ buffer_remove(c->in, hdr->size);
}
data.cmd[(sizeof data.cmd) - 1] = '\0';