Alexis La Goutte
f5eceb4ad0
blf: fix Wunreachable-code
...
blf.c:764:47: warning: code will never be executed [-Wunreachable-code]
2022-02-13 10:23:42 +00:00
Gerald Combs
46cb5d5252
BLF: Make sure a struct is completely initialized.
...
Initialize infstream. Fixes
```
*** CID 1497282: (UNINIT)
/builds/wireshark/wireshark/wiretap/blf.c: 506 in blf_pull_logcontainer_into_memory()
500 }
501
502 int ret = inflate(&infstream, Z_NO_FLUSH);
503 /* Z_OK should not happen here since we know how big the buffer should be */
504 if (Z_STREAM_END != ret) {
505 ws_debug("inflate failed (return code %d) for LogContainer %d", ret, index_log_container);
>>> CID 1497282: (UNINIT)
>>> Using uninitialized value "infstream.msg".
506 if (infstream.msg != NULL) {
507 ws_debug("inflate returned: \"%s\"", infstream.msg);
508 }
509 return FALSE;
510 }
511
/builds/wireshark/wireshark/wiretap/blf.c: 514 in blf_pull_logcontainer_into_memory()
508 }
509 return FALSE;
510 }
511
512 if (Z_OK != inflateEnd(&infstream)) {
513 ws_debug("inflateEnd failed for LogContainer %d", index_log_container);
>>> CID 1497282: (UNINIT)
>>> Using uninitialized value "infstream.msg".
514 if (infstream.msg != NULL) {
515 ws_debug("inflateEnd returned: \"%s\"", infstream.msg);
516 }
517 return FALSE;
518 }
519
/builds/wireshark/wireshark/wiretap/blf.c: 496 in blf_pull_logcontainer_into_memory()
490 infstream.avail_out = (unsigned int)tmp.real_length;
491 infstream.next_out = buf;
492
493 /* the actual DE-compression work. */
494 if (Z_OK != inflateInit(&infstream)) {
495 ws_debug("inflateInit failed for LogContainer %d", index_log_container);
>>> CID 1497282: (UNINIT)
>>> Using uninitialized value "infstream.msg".
496 if (infstream.msg != NULL) {
497 ws_debug("inflateInit returned: \"%s\"", infstream.msg);
498 }
499 return FALSE;
500 }
501
```
2022-01-18 00:15:36 +00:00
Dr. Lars Völker
4107d5dd6e
BLF: improved checks to avoid hangs
...
Improvements to fix a few hang scenarios found by fuzzing.
2022-01-16 07:44:19 +00:00
Dr. Lars Völker
dd663c8c7f
BLF: Improve handling of zlib errors
2022-01-15 08:30:36 +00:00
Dr. Lars Völker
e9d650362c
BLF: improve debug log output
2022-01-14 21:51:29 +01:00
Gerald Combs
27ccf26b4b
BLF: Fix a coverity warning.
...
Fix
```
*** CID 1496851: Resource leaks (RESOURCE_LEAK)
/builds/wireshark/wireshark/wiretap/blf.c: 1621 in blf_read_apptextmessage()
1615 }
1616
1617 gchar *text = g_try_malloc0((gsize)apptextheader.textLength);
1618
1619 if (!blf_read_bytes(params, data_start + sizeof(apptextheader), text, apptextheader.textLength, err, err_info)) {
1620 ws_debug("not enough bytes for apptext text in file");
>>> CID 1496851: Resource leaks (RESOURCE_LEAK)
>>> Variable "text" going out of scope leaks the storage it points to.
1621 return FALSE;
1622 }
1623
1624 /* returns a NULL terminated array of NULL terminates strings */
1625 gchar **tokens = g_strsplit_set(text, ";", -1);
```
2022-01-05 05:21:25 +00:00
Dr. Lars Völker
19ed057563
BLF: Adding support to read interface names
...
This patch reads out the interface of the meta data in BLF to set the
interface names in Wireshark to these values.
2022-01-03 07:58:47 +00:00
João Valverde
0ccd69e530
Replace g_strdup_printf() with ws_strdup_printf()
...
Use macros from inttypes.h.
2021-12-19 21:21:58 +00:00
João Valverde
fe5248717f
Replace g_snprintf() with snprintf()
...
Use macros from inttypes.h with format strings.
2021-12-19 20:06:13 +00:00
John Thacker
85a8de25a4
blf: Set OPT_IDB_TSRESOL
...
In addition to setting tsprecision and time_units_per_second, add
the OPT_IDB_TSRESOL option as well, because pcapng expects that to
be set if tsprecision is anything other than the default.
2021-12-15 07:22:51 +00:00
Dr. Lars Völker
c44e14a4ba
BLF: Direction is not ignored anymore (BUGFIX)
...
This patch adds direction support, so that incoming and outgoing frames
can be differentiated.
2021-10-26 20:45:33 +00:00
Guy Harris
9fcc11cc9b
blf: report a bunch of errors.
2021-09-12 01:21:31 -07:00
Guy Harris
fdf2d78d9a
blf: most reads in a packet are errors even if they get an EOF.
...
If the *first* read for a packet gets an EOF, it means that there is an
EOF right at the point where you're reading, which means "no more
packets".
If you get an EOF on any *subsequent* reads for the packet, it means the
file was cut off in the middle of the packet's record, which is an error.
2021-09-12 00:47:07 -07:00
Guy Harris
b6d1806053
blf: remove the function name from ws_debug() calls.
...
ws_debug() inserts the file name, line number, and function name into
the ws_debug() message (assuming the function name can be obtained from
a macro), so there's no need to include it in the text of the message
(we don't do so elsewhere).
2021-09-12 00:07:55 -07:00
Guy Harris
89368f9d28
blf: do more work in blf_init_rec().
...
Set the block, presence flags, capture length, and length there.
2021-09-11 18:48:55 -07:00
Guy Harris
5aad28d773
blf: use common code to read the log object header.
2021-09-11 17:04:23 -07:00
Guy Harris
8307d5d9be
blf: fix indentation.
...
Fix indentation of a while() clause, so that it's indented less than the
body of the while() loop.
2021-09-11 14:27:48 -07:00
Guy Harris
8b614c6a1c
blf: make blf_read_block() static.
...
It's not used outside blf.c.
2021-09-11 13:23:18 -07:00
Guy Harris
76b08ea083
Fix spelling errors.
...
The Ubuntu build commented on some spelling errors in executable code
files. Fix the errors that don't come from external files containing
the spelling errors (USB product and vendor IDs, PCI IDs, ASN.1
specifications), and fix some errors that don't show up in the
executable code files (e.g., in comments and variable names).
2021-09-11 10:01:27 +00:00
Dr. Lars Völker
be7b4163de
BLF: Adding LIN support
...
This patch adds support for LIN Messages in BLF.
2021-09-09 09:19:36 +00:00
Tomas Kukosa
dde6fde173
Vector BLF: add WLAN interface name
2021-09-03 05:03:48 +00:00
Tomas Kukosa
bf1039a529
Vector BLF: WLAN frame supported
2021-09-03 05:03:48 +00:00
Dr. Lars Völker
0091a83e31
BLF: adding Interface blocks (bugfix)
...
This patch adds code to add the interface blocks, so that the packets
read by blf can be written again (e.g., to pcapng).
2021-08-23 21:19:29 +02:00
Dr. Lars Völker
5de353f324
BLF: WTAP_BLOCK_PACKET should have been MULTIPLE_BLOCKS_SUPPORTED
2021-08-23 20:30:12 +02:00
Gerald Combs
dead9f13e9
wiretap: Fix some BLF warnings.
...
Make a bunch of functions in blf.c static.
2021-08-04 09:51:05 -07:00
Dr. Lars Völker
f27c98ad2b
BLF: Cleanup and fix for start time
2021-08-04 14:58:03 +02:00
David Perry
dc7089e831
Carry drop count/packet ID/queue ID as options on packet block
2021-07-19 21:25:40 +00:00
Gerald Combs
50da270b8a
BLF: Fix Win32 compilation issues.
...
Fix
```
wiretap\blf.c(368,73): error C2220: the following warning is treated as an error [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(368,73): error C2220: unsigned char *compressed_data = g_try_malloc0(tmp.infile_length); [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(368,73): error C2220: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(368,73): warning C4244: 'function': conversion from 'guint64' to 'gsize', possible loss of data [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(368,73): warning C4244: unsigned char *compressed_data = g_try_malloc0(tmp.infile_length); [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(368,73): warning C4244: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(375,59): warning C4244: 'function': conversion from 'guint64' to 'gsize', possible loss of data [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(375,59): warning C4244: unsigned char *buf = g_try_malloc0(tmp.real_length); [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(375,59): warning C4244: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(654,23): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(654,23): warning C4018: if (object_length < (data_start - block_start) + sizeof(blf_ethernetframeheader_t)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(654,23): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
busmaster.c
wiretap\blf.c(733,23): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(733,23): warning C4018: if (object_length < (data_start - block_start) + sizeof(blf_ethernetframeheader_ex_t)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(733,23): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(818,23): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(818,23): warning C4018: if (object_length < (data_start - block_start) + sizeof(canheader)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(818,23): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(859,27): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(859,27): warning C4018: if (object_length < (data_start - block_start) + sizeof(canheader) + payload_length_valid + sizeof(can2trailer)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(859,27): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(894,23): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(894,23): warning C4018: if (object_length < (data_start - block_start) + sizeof(canheader)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(894,23): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(966,23): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(966,23): warning C4018: if (object_length < (data_start - block_start) + sizeof(canheader)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(966,23): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(1045,23): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(1045,23): warning C4018: if (object_length < (data_start - block_start) + sizeof(frheader)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(1045,23): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(1126,23): warning C4018: '<': signed/unsigned mismatch [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(1126,23): warning C4018: if (object_length < (data_start - block_start) + sizeof(frheader)) { [build\wiretap\wiretap.vcxproj]
wiretap\blf.c(1126,23): warning C4018: ^ [build\wiretap\wiretap.vcxproj]
```
2021-07-18 17:05:31 -07:00
Dr. Lars Völker
796819c955
BLF: Support for BLF file format
...
This patch adds first support for the BLF file format.
2021-07-16 07:37:43 +00:00