mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05:00
Make share_got_pkt_from_server take a const pointer.
It was horrible - even if harmless in practice - that it wrote the NATed channel id over its input buffer, and I think it's worth the extra memory management to avoid doing that.
This commit is contained in:
parent
452114c3d3
commit
61a972c332
2
ssh.h
2
ssh.h
@ -27,7 +27,7 @@ extern Socket ssh_connection_sharing_init(
|
|||||||
void **state);
|
void **state);
|
||||||
int ssh_share_test_for_upstream(const char *host, int port, Conf *conf);
|
int ssh_share_test_for_upstream(const char *host, int port, Conf *conf);
|
||||||
void share_got_pkt_from_server(void *ctx, int type,
|
void share_got_pkt_from_server(void *ctx, int type,
|
||||||
unsigned char *pkt, int pktlen);
|
const void *pkt, int pktlen);
|
||||||
void share_activate(void *state, const char *server_verstring);
|
void share_activate(void *state, const char *server_verstring);
|
||||||
void sharestate_free(void *state);
|
void sharestate_free(void *state);
|
||||||
int share_ndownstreams(void *state);
|
int share_ndownstreams(void *state);
|
||||||
|
10
sshshare.c
10
sshshare.c
@ -1129,8 +1129,9 @@ void share_setup_x11_channel(void *csv, void *chanv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void share_got_pkt_from_server(void *csv, int type,
|
void share_got_pkt_from_server(void *csv, int type,
|
||||||
unsigned char *pkt, int pktlen)
|
const void *vpkt, int pktlen)
|
||||||
{
|
{
|
||||||
|
const unsigned char *pkt = (const unsigned char *)vpkt;
|
||||||
struct ssh_sharing_connstate *cs = (struct ssh_sharing_connstate *)csv;
|
struct ssh_sharing_connstate *cs = (struct ssh_sharing_connstate *)csv;
|
||||||
struct share_globreq *globreq;
|
struct share_globreq *globreq;
|
||||||
size_t id_pos;
|
size_t id_pos;
|
||||||
@ -1203,8 +1204,11 @@ void share_got_pkt_from_server(void *csv, int type,
|
|||||||
/*
|
/*
|
||||||
* The normal case: this id refers to an open channel.
|
* The normal case: this id refers to an open channel.
|
||||||
*/
|
*/
|
||||||
PUT_32BIT(pkt + id_pos, chan->downstream_id);
|
unsigned char *rewritten = snewn(pktlen, unsigned char);
|
||||||
send_packet_to_downstream(cs, type, pkt, pktlen, chan);
|
memcpy(rewritten, pkt, pktlen);
|
||||||
|
PUT_32BIT(rewritten + id_pos, chan->downstream_id);
|
||||||
|
send_packet_to_downstream(cs, type, rewritten, pktlen, chan);
|
||||||
|
sfree(rewritten);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the channel state, for messages that need it.
|
* Update the channel state, for messages that need it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user