| Bug ID: | 199 |
| Project: | Openwsman |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
openwsmand seems to sens a lot of garbage after each request, as can be seen when observed with, for example, wireshark. For instance when issuing this command from a windows box:
$ winrm.cmd e cimv2/CIM_ComputerSystem -r:192.168.46.10:8889 -a:Basic -u:wsman -p:wsman -encoding:utf-8
and observing with wireshark, packets with null bytes are being seen after the actual response. This is a bug in src/server/wsmand-listener.c, function server_callback(), where in lines 350 and 351 the (remaining) size of the buffer is confused with the size of the actual data.
This patches fixes this.
(Patch will be garbled in this description, but apparently file attachments are disabled)
--- src/server/wsmand-listener.orig.c 2008-07-08 16:46:44.000000000 -0700
+++ src/server/wsmand-listener.c 2008-07-08 16:47:08.000000000 -0700
@@ -345,10 +345,12 @@
return;
}
else {
- memcpy(arg->out.buf + arg->out.num_bytes, state->response + state->index,
- state->len - state->index);
- state->index += k ;
- arg->out.num_bytes += k;
+ int n = state->len - state->index;
+
+ memcpy(arg->out.buf + arg->out.num_bytes, state->response + state->index, n);
+
+ arg->out.num_bytes += n;
+ state->index += n;
}
shttpd_printf(arg, "\r\n\r\n");