Commit Graph

25 Commits

Author SHA1 Message Date
John Thacker 5aba5772e9 gboolean bitfields considered harmful
ISO C Std § 6.7.2, 5: "for bit-fields, it is implementation-defined
whether the specifier int designates the same type as signed int or the
same type as unsigned int." (See also the note in § 6.7.2.1 and ISO C
Std Appendix J.3.9.)

A gboolean is a typedef'd gint. Therefore, many implementations,
including gcc and clang, treat a gboolean bitfield of width 1 as
signed, meaning that it has two possible values: 0 and -1, any time
the integer promotions occur (which is all the time.) Constructs like this:

        dgram_info->from_server = TRUE;
        if (dgram_info->from_server == TRUE) ws_warning("True");

will not work as expected, though gcc (but not clang) will give an
error:

/home/johnthacker/wireshark/epan/dissectors/packet-quic.c:3457:37: error: comparison is always false due to limited range of data type [-Werror=type-limits]
 3457 |         if (dgram_info->from_server == TRUE)
      |

        proto_tree_add_debug_text(quic_tree, "Connection: %d %p from_server:%d", pinfo->num, dgram_info->conn, dgram_info->from_server);

Connection: 1 0x7fc4b47f2be0 from_server:0
Connection: 2 0x7fc4b47f2be0 from_server:-1
Connection: 3 0x7fc4b47f2be0 from_server:0
Connection: 4 0x7fc4b47f2be0 from_server:-1

At worst this can cause buffer overruns.

If a bitfield is desired, to guarantee expected behavior the standard
_Bool/bool should be used instead.
2022-07-30 08:49:08 -04:00
Moshe Kaplan 3953ddcf57 Add UI header files to Doxygen
Add @file markers for UI
header files so that Doxygen will
generate documentation for them.
2021-11-30 08:01:36 -05:00
Gerald Combs 9222bd77cd Remove unneeded modelines in ui.
Remove the editor modeline blocks from the source files in ui that use 4
space indentation by running

perl -i -p0e 's{ \n+ /[ *\n]+ editor \s+ modelines .* shiftwidth= .* \*/ \s+ } {\n}gsix' $( ag -l shiftwidth=4 $( ag -g '\.(c|cpp|h|m|mm)') )

This gives us one source of indentation truth for these files, and it
*shouldn't* affect anyone since

- These files match the default in our top-level .editorconfig.

- The one notable editor that's likely to be used on these files and
*doesn't* support EditorConfig (Qt Creator) defaults to 4 space
indentation.
2021-04-20 07:43:39 +00:00
Guy Harris 2820156fbd Move still *more* headers outside of extern "C".
If a header declares a function, or anything else requiring the extern
"C" decoration, have it wrap the declaration itself; don't rely on the
header itself being included inside extern "C".
2021-03-16 13:50:13 -07:00
Vasil Velichkov b7a6a11376 Qt: fix several crashes in the SCTP Dialogs
Store the association id instead of a pointer to the volatile
"sctp_assoc_info_t" structure because it gets freed after a rescan.

Bug: 14970
Change-Id: Id8fe2dfe3549bd711fc8ddef0770b217e83c2088
Fixes: v1.11.3-rc1-604-g796bf409b0 ("Add dialogs and graphs to analyse SCTP behavior similar to the GTK version.")
Reviewed-on: https://code.wireshark.org/review/28711
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-20 05:01:11 +00:00
Pascal Quantin 06879e89c0 SCTP: fix crash when filtering an association
Do not free a tsn_t element if it has already been inserted in a GList.
The code structure is complex enough to add an explicit check before
calling g_free().
Fixes a regression introduced in gb19ca06fcc.

While we are at it, let's call the correct free function and plug some
memory leaks.

Bug: 14733
Change-Id: I071da96982da569083fd98b790e0d37ac0826ff1
Reviewed-on: https://code.wireshark.org/review/27808
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-26 11:23:51 +00:00
ruengeler ac7e609b9f SCTP: INIT collision
Change-Id: I283ce92048af39ff4cf54e5e401e714bf6ec308b
Reviewed-on: https://code.wireshark.org/review/27023
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-04-20 08:23:05 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Gerald Combs 3ed5b4fb67 Reformat some top-level ui files.
Make sure each ui/*.[ch] file uses identical (4-space) indentation.
Remove ui/.editorconfig. Fix up other formatting where needed.
SPDX-abbreviate the license blurb in the files we modify.

Change-Id: I5faa1c1eae9a4b6220422ad8e4ba7a341c7deb1f
Reviewed-on: https://code.wireshark.org/review/24632
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-30 00:14:16 +00:00
Gerald Combs bfad9c56f9 CMake: Don't check for windows.h or winsock2.h.
If we're building on Windows we're going to have windows.h and
winsock2.h. Don't bother checking for them.

Change-Id: I0004c44d7364ab3f41682f34b8c84cd8617c9603
Reviewed-on: https://code.wireshark.org/review/24068
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-26 07:08:41 +00:00
ruengeler c63f895159 SCTP: find right assoc id
Change-Id: I107b7f4c585ef5e080d6473a37b3db9a97f12365
Reviewed-on: https://code.wireshark.org/review/18325
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-10-25 16:24:51 +00:00
Guy Harris a5dee51a1a Move some definitions and declarations around.
This removes duplicates (including one incorrect duplicate), and also
means we have only one chunk_type_values[] value_string.

Change-Id: I4c3035b1cfb5c86cc7a5bf79feb9a5b0204b6dcc
Reviewed-on: https://code.wireshark.org/review/13212
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-12 07:22:30 +00:00
ruengeler d52322efb3 SCTP I-DATA support
Change-Id: I459942b9e3287d500dda517568252d4cb56d3216
Reviewed-on: https://code.wireshark.org/review/10802
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Michael Tüxen <tuexen@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
2015-10-05 17:38:08 +00:00
Michael Tüxen c53d2f0d0e Revert "SCTP: Add I_DATA support"
This reverts commit 4e9361dc88.

Change-Id: Ia7aee9ffbe5bc5d3ae88e957c234cbee7b65f457
Reviewed-on: https://code.wireshark.org/review/10723
Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
2015-10-01 14:22:12 +00:00
ruengeler 4e9361dc88 SCTP: Add I_DATA support
Change-Id: Ib8566b7d94fdafdb9735b356d129f378c94af3cf
Reviewed-on: https://code.wireshark.org/review/10716
Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
2015-10-01 11:47:04 +00:00
Bill Meier bfe3706035 Always put editor-modelines at the end of the file ...
... to ensure that there are no potential issues with respect to
editors limiting the number of lines scanned at the end of the file
when checking for editor modelines.

Change-Id: Ic85cbb108bb5159d6ec4116fea11f5eebb4e44a4
Reviewed-on: https://code.wireshark.org/review/4688
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-14 20:08:29 +00:00
Bill Meier 1b8b2a8aa8 Add editor modelines; Adjust whitespace as needed.
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad
Reviewed-on: https://code.wireshark.org/review/4626
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-12 18:58:32 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Irene Rüngeler dafe3d02ce Address more Windows errors.
svn path=/trunk/; revision=54032
2013-12-13 09:52:41 +00:00
Irene Rüngeler 66d0882e85 Address Windows warning.
svn path=/trunk/; revision=54028
2013-12-13 08:41:26 +00:00
Irene Rüngeler 796bf409b0 Add dialogs and graphs to analyse SCTP behavior similar to the GTK version.
svn path=/trunk/; revision=54026
2013-12-13 07:25:30 +00:00
Irene Rüngeler 15a7add3ce Add licence information.
svn path=/trunk/; revision=52999
2013-10-31 07:54:06 +00:00
Jeff Morriss aa452c378f Set SVN properties.
svn path=/trunk/; revision=52976
2013-10-30 00:43:46 +00:00
Irene Rüngeler 6d3988ffd3 Make the packet analysis for SCTP independent from GTK and QT.
svn path=/trunk/; revision=52945
2013-10-29 12:11:23 +00:00