From 185e7749a3011a0f079b2a5c400dfbd6532729d3 Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Wed, 10 Oct 2012 23:16:31 +0200 Subject: [PATCH] mux.c: replace sshbuf_get_stringb with sshbuf_froms --- ssh/mux.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ssh/mux.c b/ssh/mux.c index 2086a84..85b8ef3 100644 --- a/ssh/mux.c +++ b/ssh/mux.c @@ -1013,7 +1013,7 @@ static int mux_master_read_cb(Channel *c) { struct mux_master_state *state = (struct mux_master_state *)c->mux_ctx; - struct sshbuf *in, *out; + struct sshbuf *in = NULL, *out = NULL; u_int type, rid, i; int r, ret = -1; @@ -1036,13 +1036,8 @@ mux_master_read_cb(Channel *c) return 0; } - if ((in = sshbuf_new()) == NULL) - fatal("%s: sshbuf_new failed", __func__); - if ((out = sshbuf_new()) == NULL) - fatal("%s: sshbuf_new failed", __func__); - /* Channel code ensures that we receive whole packets */ - if ((r = sshbuf_get_stringb(c->input, in)) != 0) { + if ((r = sshbuf_froms(c->input, &in)) != 0) { malf: error("%s: malformed message: %s", __func__, ssh_err(r)); goto out; @@ -1065,6 +1060,9 @@ mux_master_read_cb(Channel *c) goto malf; } + if ((out = sshbuf_new()) == NULL) + fatal("%s: sshbuf_new failed", __func__); + for (i = 0; mux_master_handlers[i].handler != NULL; i++) { if (type == mux_master_handlers[i].type) { ret = mux_master_handlers[i].handler(rid, c, in, out);