[RFC]androiddump: Only filter CR/LFs on Windows

Comments in code claim:
"The data we are getting from the tcpdump stdoutput stream as the
 stdout is the text stream it is convertinng the 0A=0D0A; So we
 need to remove these extra character."

This is not true on non-Windows systems at least so avoid the filter
when not built for Windows.

NOTE: A problem with the filter is that it operates on all bytes
received on the socket, including packet data(!). Capturing
data with CR/LFs (for example an HTTP request) will fail. Ideally
the filter should be replaced with some other mechanism but as I
don't have a Windows system to verify that the comment claims are
valid, this change will at least make androiddump work on
non-Windows systems.

Bug: 13510
Change-Id: Ic00f44fa7516c0db7fc015ed8685deb365a347db
Reviewed-on: https://code.wireshark.org/review/22397
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Mikael Kanstrup 2017-06-24 16:24:52 +02:00 committed by Roland Knall
parent 7ecea31581
commit 66507b9052
1 changed files with 2 additions and 0 deletions

View File

@ -2579,9 +2579,11 @@ static int capture_android_wifi_tcpdump(char *interface, char *fifo,
gssize i = 0,read_offset,j=0;
/*Filter the received data to get rid of unwanted 0DOA*/
for (i = 0; i < (used_buffer_length - 1); i++) {
#ifdef _WIN32
if (data[i] == 0x0d && data[i + 1] == 0x0a) {
i++;
}
#endif
filter_buffer[filter_buffer_length++] = data[i];
}