Commit Graph

147 Commits

Author SHA1 Message Date
João Valverde 7738d5af5d MSYS2: Add some packages for missing dependencies
Add mingw packages for dependencies that are missing upstream;
these should eventually be submitted there.

Fix a version check for libsmi.

Update README.
2023-01-16 13:30:43 +00:00
João Valverde f75b79a59d Move wmem string utility functions to wsutil 2021-12-19 10:47:50 +00:00
Evan Huus a97e34a1c1 oids: remove global scopes from debug code
It can all just use NULL scope anyway.
2021-09-07 17:39:22 +00:00
João Valverde 7b845e7194 wsutil: rename bytestring_to_str() -> bytes_to_str_punct() 2021-07-29 17:23:05 +00:00
João Valverde 133b0c583f Move epan/wmem/wmem_scopes.h to epan/
This header was installed incorrectly to epan/wmem_scopes.h.

Instead of creating additional installation rules for a single
header in a subfolder (kept for backward compatibility) just
rename the standard "epan/wmem/wmem.h" include to
"epan/wmem_scopes.h" and fix the documentation.

Now the header is installed *correctly* to epan/wmem_scopes.h.
2021-07-26 14:56:11 +00:00
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +00:00
João Valverde 9ba97d12d6 Add ws_debug() and use it
Replace most instances of ws_debug_printf() except in
epan/dissectors and dissector plugins.

Some replacements use printf(), some use ws_debug(), and
some were removed because they were dead or judged to be
temporary.
2021-05-24 01:13:19 +00:00
Guy Harris c73ab16bef OID handling: fix a memory leak.
There's a "break" in some code that appears to be copied and pasted from
a switch statement; the break would exit the loop (and leak memory
allocated within the loop), which does not appear to be the intent, so
it may have been copied over incorrectly.  Remove it.

While we're at it, redo the "constant-time append to the end of a loop"
code to be a bit clearer, both to humans reading the code and code
analyzers reading the code.
2021-05-23 01:27:11 -07:00
Moshe Kaplan 5227f385b8 Replace g_malloc calls with g_new
Replace calls of `g_malloc(sizeof(foo_t))` with
`g_new(foo_t, 1)`, to improve readability.
2020-12-22 15:48:48 +00:00
Anders Broman 6dada3acf2 SNMP: Use BASE_SHOW_ASCII_PRINTABLE for octet strings
Closes #16900
2020-10-10 13:28:06 +00:00
Peter Wu 36e1f782aa epan,packaging: convert http URLs to https
Ensure that public text in error messages and dialogs point to https.
Ensure that the generated PDML files include scripts over https.

Change-Id: I75d42704c2bbb33b05492261b3e1d45dc6e301f9
Reviewed-on: https://code.wireshark.org/review/34027
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-20 20:50:59 +00:00
Peter Wu 10306f9a32 Free g_array_free-related memory leaks
g_array_free(a, FALSE) returns "a->data". Callers that do not handle
this will leak memory. Convert other users to use the return value
instead of direct access to "a->data".

Change-Id: I0a29864e8106c0bf09e9573ef29e4474179c4171
Reviewed-on: https://code.wireshark.org/review/27438
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-14 13:44:23 +00:00
Jaap Keuter 2f34f26203 OID name resolv: Fix MIB/PIB path presentations
oids.c: Sort out libsmi init, add user paths once.
Qt, About WS: Stop memory leak of MIB/PIB paths.
GTK, About WS: Allow for 20 individual paths.
tshark, folders: init before getting paths, allow 20 individual.

Bug: 14539
Change-Id: I113ee2dd4394d553a16b256e66fd840eeeec78ef
Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-on: https://code.wireshark.org/review/26555
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-24 07:07:14 +00:00
Pascal Quantin f46d129f21 oids.c: fix a memory leak in oid_string2subid()
Bug: 14485
Change-Id: Ia0ccd4480808c4f5da228975c7a076cd3f5d332b
Reviewed-on: https://code.wireshark.org/review/26290
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: ronnie sahlberg <ronniesahlberg@gmail.com>
2018-03-07 06:01:57 +00:00
Guy Harris 1c5e6a1b34 Eliminate another casting-away-constness warning.
Don't fill in a structure if you're not going to use it.  Fixing that
means you don't have to free something you've allocated for the
structure.

Change-Id: I6b151b2df43a6444c25583a100f142a51d922c2f
Reviewed-on: https://code.wireshark.org/review/25955
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-21 02:32:46 +00:00
Guy Harris dc1ab9f32b Remove a casting-away-constness warning.
Keep the pointer to the allocated data in a non-const pointer, and free
it using *that* pointer.

Change-Id: I7d29b6768be58ed0181cd64c68ac0b7d03ec5611
Reviewed-on: https://code.wireshark.org/review/25954
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-21 02:17:37 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Guy Harris 2c44a7f930 Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in
libwsutil, and rename files and routines appropriately, as they don't
only handle errors any more.

Have a routine read_enabled_and_disabled_protos() that reads all the
files that enable or disable protocols or heuristic dissectors, enables
and disables them based on the contents of those files, and reports
errors itself (as warnings) using the new "report a warning message"
routine.  Fix that error reporting to report separately on the disabled
protocols, enabled protocols, and heuristic dissectors files.

Have a routine to set up the enabled and disabled protocols and
heuristic dissectors from the command-line arguments, so it's done the
same way in all programs.

If we try to enable or disable an unknown heuristic dissector via a
command-line argument, report an error.

Update a bunch of comments.

Update the name of disabled_protos_cleanup(), as it cleans up
information for disabled *and* enabled protocols and for heuristic
dissectors.

Support the command-line flags to enable and disable protocols and
heuristic dissectors in tfshark.

Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df
Reviewed-on: https://code.wireshark.org/review/20966
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-08 20:40:08 +00:00
Alexis La Goutte 77aa6744ca oids: fix this statement may fall through [-Werror=implicit-fallthrough] found by gcc7
Change-Id: I8f84414be693ea8ebcfef003480e9ee05de94ea0
Reviewed-on: https://code.wireshark.org/review/20495
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-03-11 17:29:24 +00:00
Dario Lombardo 805ddd1add uat: add a reset callback.
This function will free the resources allocated by the caller.

Change-Id: Ib486c14e4fd3c321662fb71f7fd06733ce9a64a4
Reviewed-on: https://code.wireshark.org/review/19375
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-12 12:39:15 +00:00
Jaap Keuter ba67963fd4 Improve name resolution preference tooltips.
Change the tooltips texts to make them better describe the preference.

Bug: 13130
Bug: 13131
Change-Id: Ie753e3703a702bdafed91cf0f41b306347088526
Reviewed-on: https://code.wireshark.org/review/18878
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-11-22 16:47:11 +00:00
Michael Mann 573171934f Fix checkAPI warning for printf.
Another legitimate use, so use ws_debug_printf.

Change-Id: I9bebe01e80987caf8e18a59b93a48f9a2d6ee397
Reviewed-on: https://code.wireshark.org/review/16835
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-02 01:54:37 +00:00
Guy Harris a52793aec1 Remove trailing "." from OID strings.
The previous change removed code that did that.

Change-Id: If297018f5902af7a2d9cacb0cc9a5f1ffe1e1d00
Reviewed-on: https://code.wireshark.org/review/16834
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-02 00:36:06 +00:00
Michael Mann 078ba235af oids.c: Use wmem_strbuf instead of trying to accommodate snprintf.
Change-Id: I5222fbd07b7d1301386f7a206fef688793dd6be7
Reviewed-on: https://code.wireshark.org/review/16802
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-31 15:30:27 +00:00
Gerald Combs 90e1232672 Use faster string functions at startup.
Use wmem_strconcat and g_strconcat instead of wmem_strdup_printf and
g_strdup_printf when we register various protocols. This shows a fairly
significant speedup in the Visual Studio profiler.

Change-Id: I98709329513daa66ad3665925dc69149c43df884
Reviewed-on: https://code.wireshark.org/review/14855
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-07 22:36:28 +00:00
João Valverde cbc36cbd97 Remove constness from bytestring_to_str() [-Wcast-qual]
Change-Id: I7f942787dfdc4f76dd0ad5111d1eb528b20f0ba9
Reviewed-on: https://code.wireshark.org/review/13011
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-07 22:40:30 +00:00
AndersBroman 992c892b93 MIB/OID Fix assertion in proto.c tmp_fld_check_assert().
It seems like oid_data->name may get freed so do a g_strdup() as it's done
for hf.hfinfo.abbrev.

Change-Id: Ie05fb42d59556aec300d4e007b1db5cc79d8d6f1
Reviewed-on: https://code.wireshark.org/review/9864
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-04 14:55:31 +00:00
Bill Meier e88a11f5c9 (Trivial) Fix printf-related 'Mismatch on sign' warnings
Found by MSVC2013 Code Analysis

Change-Id: I58063946dd558e98308c87b36eeac0ddbe1a6e79
Reviewed-on: https://code.wireshark.org/review/7045
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-09 18:57:14 +00:00
Evan Huus 2eaa467b34 oids: fix memory leak
In oid_encoded2subid_sub(), the scope we get may be NULL, in which case if we
don't return our allocated buffer, it is our responsibility to free it. Minor
regression from ge333e4c90f0aca41b0a56cef22fd80d0b0e73e14.

Bug: 10883
Change-Id: I324ca770278ab0575511c5e9ab72b70d6ac1a391
Reviewed-on: https://code.wireshark.org/review/6748
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-23 01:56:17 +00:00
Michael Mann e333e4c90f Convert OID APIs to use wmem.
There are a few oid functions that are only called in oids_test.c.  I'll presume the APIs are used in proprietary dissectors rather than just remove them.

Change-Id: I4595e00f93bf9ab8cf2493fe0432b91960f55a3f
Reviewed-on: https://code.wireshark.org/review/6592
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-19 02:52:11 +00:00
Guy Harris 63a3d043e3 Consistently use the "g_string_free returns a C string pointer" idiom.
g_string_free(str, FALSE) frees the GString container but not the
underlying g_malloc()ed string; instead, it returns a pointer to the
g_malloc()ed string.

Fix those places that didn't already get the string pointer from
g_string_free() to do so rather than manually extracting the string
themselves.

And fix one place that didn't even need to use a string - it was just
scanning a C string without even modifying it.

Change-Id: Ibbf4872bf5b9935b9907f539b6edb1013f3053a5
Reviewed-on: https://code.wireshark.org/review/6532
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 23:14:13 +00:00
Michael Mann 493f03b420 Remove bytestring_to_ep_str
Use wmem equivalent bytestring_to_str

Change-Id: I1ec7509e3adb36ab0f65317459653cb3b4b11af8
Reviewed-on: https://code.wireshark.org/review/6368
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07 18:01:15 +00:00
Michael Mann ed58d88db1 Remove some proto_tree_add_text outside the dissector directory.
Change-Id: I890846a0cede755a603243b4048fb5c917b2826b
Reviewed-on: https://code.wireshark.org/review/6112
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-29 23:10:12 +00:00
Guy Harris 8ea4df97e0 Use g_ascii_isalnum() rather than isalnum().
Only *ASCII* alphanumerics are allowed in filterable field names, so use
g_ascii_isalnum() to check for them.  That avoids issues with characters
with the 8th bit set and avoids locale-dependent behavior.

Change-Id: I4e3c4eec907f5e576629229fcf154fcf728b7a2e
Reviewed-on: https://code.wireshark.org/review/4973
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-28 18:19:15 +00:00
Gerald Combs 7ac3ed366c Fix unused variable warnings found by clang.
Change-Id: I31ff6d9bfcedfc1e3cab4e191d8dbf8de347abb1
Reviewed-on: https://code.wireshark.org/review/1065
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-04-11 01:32:13 +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
Anders Broman 95ed1b4977 As spotted by Joerg; make a HFILL_INIT(hf) macro and use it to init the private part of the hf structure.
svn path=/trunk/; revision=54843
2014-01-19 09:40:04 +00:00
Guy Harris f862fc40ba Don't cast away constness.
svn path=/trunk/; revision=54800
2014-01-14 18:35:36 +00:00
Anders Broman 9c05ac141d Fix a typo.
svn path=/trunk/; revision=54617
2014-01-06 17:12:54 +00:00
Anders Broman ef399fb652 Try to fix warning: initializer element is not computable at load time.
svn path=/trunk/; revision=54616
2014-01-06 15:30:01 +00:00
Evan Huus b2e5e4a81a First round converting OIDs from emem to wmem. Just internal functions so far.
svn path=/trunk/; revision=54420
2013-12-23 20:52:12 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
Bill Meier 21bed98150 Fix several [-Wunused-const-variable] warnings (using '#if 0').
svn path=/trunk/; revision=52866
2013-10-26 03:16:57 +00:00
Michael Mann 3635bea0a4 Add OID unit tests. Bug 9294 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9294)
From Ed Beroset

svn path=/trunk/; revision=52692
2013-10-19 18:52:13 +00:00
Evan Huus 5344c7fef2 If the length we allocated was 0, don't try and write to the returned pointer.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9276

svn path=/trunk/; revision=52655
2013-10-16 22:52:40 +00:00
Evan Huus a6d8e1888c Fix a length check in the OID code, we add an extra byte if is_first, not the
other way around. Also add an assert so it blows up if we get it wrong, rather
than leading to uninitialized memory.

Fixes the last errors I can find in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9268

svn path=/trunk/; revision=52615
2013-10-15 12:34:45 +00:00
Evan Huus a50dee3286 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9246
Fix memory leaks and bad memory accesses in c1222 dissector.

From me: use realloc in a handoff function since it may get called multiple
times, and we only need the latest.

svn path=/trunk/; revision=52497
2013-10-10 16:18:49 +00:00
Evan Huus 69da562c83 Don't try and construct an OID string if the len is zero. Fixes
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9246

svn path=/trunk/; revision=52455
2013-10-08 21:12:06 +00:00