aboutsummaryrefslogtreecommitdiffstats
path: root/epan/diam_dict.l
AgeCommit message (Collapse)AuthorFilesLines
2022-11-20Add macros to control lemon diagnosticsJoão Valverde1-2/+2
Rename flex macros using parenthesis (mostly a style issue): DIAG_OFF_FLEX -> DIAG_OFF_FLEX() DIAG_ON_FLEX -> DIAG_ON_FLEX() Use the same kind of construct with lemon generated code using DIAG_OFF_LEMON() and DIAG_ON_LEMON(). Use %include and %code directives to enforce the desired order with generated code in the middle in between pragmas. Fix a clang-specific pragma to use DIAG_OFF_CLANG(). DIAG_OFF(unreachable-code) -> DIAG_OFF_CLANG(unreachable-code). Apparently GCC is ignoring the -Wunreachable flag, that's why it did not trigger an unknown pragma warning. From [1}: The -Wunreachable-code has been removed, because it was unstable: it relied on the optimizer, and so different versions of gcc would warn about different code. The compiler still accepts and ignores the command line option so that existing Makefiles are not broken. In some future release the option will be removed entirely. - Ian [1] https://gcc.gnu.org/legacy-ml/gcc-help/2011-05/msg00360.html
2021-12-19epan: Convert to use stdio.h from GLibJoão Valverde1-1/+1
Replace: g_snprintf() -> snprintf() g_vsnprintf() -> vsnprintf() g_strdup_printf() -> ws_strdup_printf() g_strdup_vprintf() -> ws_strdup_vprintf() This is more portable, user-friendly and faster on platforms where GLib does not like the native I/O. Adjust the format string to use macros from intypes.h.
2021-10-22Windows: Fix warnings using flexJoão Valverde1-0/+1
Fix some warnings complaining of macro redefinitions with stdint.h. Include stdint.h via wireshark.h everywhere so it stays fixed.
2019-01-19diam_dict.l,wimaxasncp_dict.l: fix -Werror=stringop-truncationPeter Wu1-2/+2
The given "len" is the size of the string in "txt" excluding the NUL terminator. GCC 8.2.1+20181127-1 rightfully complains that strncpy will not terminate the destination buffer. Change-Id: I592c7c218cf07c13697de4e60f454326a93d1124 Reviewed-on: https://code.wireshark.org/review/31600 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-03If we're reading from a string, don't fclose yyin.Guy Harris1-1/+14
yyin is initialized to stdin. When we're reading from files, we set it so that it points to the FILE from which we're reading, but when we're reading from a string, we don't set it, leaving it to point to stdin. This means that, just as the "read from the input" routine has to be set differently when reading from a file or a string, the "close the current input" routine has to be set differently as well. Bug: 14577 Change-Id: Ie05880775612867e9037ace2de0cd0a0dd2fabb5 Reviewed-on: https://code.wireshark.org/review/26719 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-16Use DIAG_OFF_FLEX/DIAG_ON_FLEX more consistently.Guy Harris1-13/+8
Add warning C4267 (size_t to int conversion) with MSVC to DIAG_OFF_FLEX. Addd -Wshorten-64-to-32 with Clang and GCC to DIAG_OFF_FLEX. Don't explicitly use #pragma to turn off warnings; use DIAG_OFF_FLEX for all of them. If we use DIAG_OFF_FLEX, use DIAG_ON_FLEX, even if we have no section of entirely included code at the end. Change-Id: Ibfd44e8954704e9a8bcb1bd8e54f31d28357fffb Reviewed-on: https://code.wireshark.org/review/25817 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-15Disable warning C4267 in generated files.Gerald Combs1-0/+6
Disable warning C4267 in Visual C++ in order to squelch the following warnings: 125>dtd_parse.c(1699): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\epan\epan.vcxproj] 125>diam_dict.c(2348): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\epan\epan.vcxproj] 125>C:/buildbot/builders/windows-x86-64-petri-dish/windows-x86-64-petri-dish/build/cmbuild/epan/uat_load.c(1476): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\epan\epan.vcxproj] 130>wimaxasncp_dict.c(2103): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data [C:\buildbot\builders\windows-x86-64-petri-dish\windows-x86-64-petri-dish\build\cmbuild\plugins\epan\wimaxasncp\wimaxasncp.vcxproj] Change-Id: Ie29ae096e5a8b5037abaf3f2aa97754260f4cace Reviewed-on: https://code.wireshark.org/review/25800 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-09-19Disable flex-generated [-Wsign-compare] warningsJoão Valverde1-0/+4
Change-Id: Iace0462e6bb50573f3e4603f7a19e4b7ee1f9733 Reviewed-on: https://code.wireshark.org/review/23541 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-08-15Update RFC and I-D references.Guy Harris1-0/+3
Give draft-frascone-xml-dictionary for the dictionary syntax. Give RFC numbers and I-D names, rather than URLs to the plain text versions of them; that way, you can more easily go to the HTML versions, which give more information. The "more information" for I-Ds may include later drafts and the final RFCs, and for RFCs may give newer RFCs obsoleting the older ones; add the RFC numbers for the I-Ds and the RFC number for the current Diameter RFC. Change-Id: If01ea341af3ae892755a243bd1dd66acfdfd5062 Reviewed-on: https://code.wireshark.org/review/23086 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-02Include config.h at the very beginning of all Flex scanners.Guy Harris1-2/+5
That way, if we #define anything for large file support, that's done before we include any system header files that either depend on that definition or that define it themselves if it's not already defined. Change-Id: I9b07344151103be337899dead44d6960715d6813 Reviewed-on: https://code.wireshark.org/review/19035 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-31diam_dict.l: remove use of strdupPeter Wu1-16/+6
This should fix crashes on Windows, _strdup should not be mixed with g_free. This was only uncovered in v2.3.0rc0-474-ga04b6fc, before that ddict_free was never called. Change-Id: I34111385c82715de70fb42fe44b99b89e132a374 Reviewed-on: https://code.wireshark.org/review/17423 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-31Revert "Revert "diameter: fix 400kb leaked memory on exit""Guy Harris1-7/+28
This reverts commit 5fea2b5f4198f1a36f313ef38532ddffd02ac5b1. I.e., it puts back the change; the reverted version passed the tests on which the versions with this change crashed. Change-Id: Idcc0eb11588cf14e2fe666de1905ee63917b0fcf Reviewed-on: https://code.wireshark.org/review/17413 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-31Revert "diameter: fix 400kb leaked memory on exit"Guy Harris1-28/+7
This reverts commit a04b6fcb3db901734ed948134c973996786be8b7. Temporary revert to see if this prevents the "tshark -G" crashes being seen on the 64-bit Windows buildbot. Change-Id: I561439039ca2667b72d7e2319a6f3f5f97e18d15 Reviewed-on: https://code.wireshark.org/review/17412 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-29diameter: fix 400kb leaked memory on exitPeter Wu1-7/+28
Before: SUMMARY: AddressSanitizer: 399684 byte(s) leaked in 17208 allocation(s). After addressing to-do by calling ddict_free: SUMMARY: AddressSanitizer: 3024 byte(s) leaked in 256 allocation(s). After fixing all remaining leaks cases in the flex file for diameter: SUMMARY: AddressSanitizer: 735 byte(s) leaked in 58 allocation(s). Not bad huh :-) Ping-Bug: 12790 Change-Id: I0c730ad77ae15c69390bc6cf0a3a985395a64771 Reviewed-on: https://code.wireshark.org/review/17364 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-06-07Free if the pointer to the item being freed is *non*-null, not if it's null.Guy Harris1-5/+5
Bug: 12497 Change-Id: I282411e36783e735b02b66a024627287767813e2 Reviewed-on: https://code.wireshark.org/review/15773 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-13Windows: Remove the need for _CRT_NONSTDC_NO_DEPRECATE.Gerald Combs1-6/+16
Replace some function calls with their non-deprecated equivalents so that we can remove _CRT_NONSTDC_NO_DEPRECATE from CMakeLists.txt and config.nmake. Leave _CRT_SECURE_NO_DEPRECATE in place. Removing it failed with 145 warnings and 72 errors. Note that we could probably improve startup performance by using wmem in diam_dict.*. Change-Id: I6e130003de838aebedbdd1aa78c50de8a339ddcb Reviewed-on: https://code.wireshark.org/review/14883 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-04Don't double-close the input.Guy Harris1-1/+4
Change-Id: I3f02227f9cda2ad4c878e2a736923919e10fbf25 Reviewed-on: https://code.wireshark.org/review/14802 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03Make the Flex scanners and YACC parser in libraries reentrant.Guy Harris1-208/+329
master-branch libpcap now generates a reentrant Flex scanner and Bison/Berkeley YACC parser for capture filter expressions, so it requires versions of Flex and Bison/Berkeley YACC that support that. We might as well do the same. For libwiretap, it means we could actually have multiple K12 text or Ascend/Lucent text files open at the same time. For libwireshark, it might not be as useful, as we only read configuration files at startup (which should only happen once, in one thread) or on demand (in which case, if we ever support multiple threads running libwireshark, we'd need a mutex to ensure that only one file reads it), but it's still the right thing to do. We also require a version of Flex that can write out a header file, so we change the runlex script to generate the header file ourselves. This means we require a version of Flex new enough to support --header-file. Clean up some other stuff encountered in the process. Change-Id: Id23078c6acea549a52fc687779bb55d715b55c16 Reviewed-on: https://code.wireshark.org/review/14719 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-14Fix format string warnings [-Wformat=]João Valverde1-3/+3
Change-Id: I266c7d422f6ade965b42a4e2e8dc01966f8eb5f8 Reviewed-on: https://code.wireshark.org/review/13932 Reviewed-by: João Valverde <j@v6e.pt>
2015-12-05Use noyywrap rather than defining our own yywrap functions.Guy Harris1-13/+5
Tweak lemonflex-tail.inc to fix an issue this reveals. It appears that, at least on the buildbots, the Visual Studio compiler no longer issues warnings for the code generated with %option noyywrap. Change-Id: Id64d56f1ae8a79d0336488a4a50518da1f511497 Reviewed-on: https://code.wireshark.org/review/12433 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-06Don't include io.h in Flex scanners - they're not interactive.Guy Harris1-1/+1
We don't have any Flex scanners that support an interactive command-line interface, so none of our scanners are, or need to be, interactive. Mark text2pcap's scanner as not interactive. That means none of our scanners should call isatty(), so they don't have any need to include <io.h> on Windows; remove that include from the Lucent/Ascent text capture scanner. Update a comment to reflect that what matters isn't whether we can read from a terminal or whether we actually do so, what matters is whether they read *interactively* from a terminal (if you want to run text2pcap reading from the standard input and type at it, be my guest). Change-Id: I59979d1fdb37e1913125a400963ff7a3fa6b9bbd Reviewed-on: https://code.wireshark.org/review/11587 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-08Allow empty-element Diameter Applications and use that format.Jeff Morriss1-0/+3
This also fixes a couple of applications that weren't properly terminated (as a result of some of my recent changes). Change-Id: I9662017a81c63aceeb950d3b29cb17dde16d4f0c Reviewed-on: https://code.wireshark.org/review/8335 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-21Allow the definition of AVPs within vendor IDs.Jeff Morriss1-9/+16
This allows for a more natural organization of AVP definitions: they can now be grouped by application (including the base application) or vendor ID. This means we can stop using the "workaround" (for those vendors who define AVPs but don't have their own application ID) of finding some random application ID to put in a vendor-specific xml file just to satisfy the parser. Rework a couple of Vendor-specific xml files as an example. Note: this does mean that vendor IDs can no longer be defined inside of the base or other application. If that's a problem the parser could be made (through some duplication of code) to understand the old format too. Change-Id: I5119f0dc7f8e3bbf59e2207046a8bb0f42ab0ca1 Reviewed-on: https://code.wireshark.org/review/8141 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-02-06(Trivial) Reformat some.Jeff Morriss1-10/+30
Change-Id: I1bed28c33d1942b9d8ee8ef341d7017d2df21f37 Reviewed-on: https://code.wireshark.org/review/6977 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-02-03Fix nameless application in NokiaSolutionsAndNetworks.xml (fromJeff Morriss1-2/+2
I4cd9bd7f7219e4d9ff1bb8a71fab32439a8a9a35). (The nameless application was causing known applications to be reported as unknown.) Add code to the Diameter dissector to report such problems at startup (similar code exists for other entities). Tweak the parser debug slightly. Change-Id: I6b28cda8660e6eb96648c7b3697d7fd85151ac96 Reviewed-on: https://code.wireshark.org/review/6927 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-06Add printf-format annotations, fix garbagePeter Wu1-1/+1
The WRETH dissector showed up some garbage in the column display. Upon further inspection, it turns out that the format string had a trailing percent sign which caused (unsigned)-1 to be returned by g_printf_string_upper_bound (in emem_strdup_vprintf). Then ep_alloc is called with (unsigned)-1 + 1 = 0 memory, no wonder that garbage shows up. ASAN could not even catch this error because EP is in charge of this. So, start adding G_GNUC_PRINTF annotations in each header that uses the "fmt" or "format" paramters (grepped + awk). This revealed some other errors. The NCP2222 dissector was missing a format string (not a security vuln though). Many dissectors used val_to_str with a constant (but empty) string, these have been replaced by val_to_str_const. ASN.1 dissectors were regenerated for this. Minor: the mate plugin used "%X" instead of "%p" for a pointer type. The ncp2222 dissector and wimax plugin gained modelines. Change-Id: I7f3f6a3136116f9b251719830a39a7b21646f622 Reviewed-on: https://code.wireshark.org/review/2881 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-19Removed SVN Id from epan dir.Dario Lombardo1-2/+0
Change-Id: I487a3451344796447f0d5621b993cc89c29e93b5 Reviewed-on: https://code.wireshark.org/review/2383 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2013-12-14More shorten-64-to-32 warnings.Gerald Combs1-6/+6
svn path=/trunk/; revision=54106
2013-11-09Include <epan/to_str.h> only when needed.Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53189
2013-03-16[-Wmissing-prototypes]Anders Broman1-12/+12
Use explicit casts. svn path=/trunk/; revision=48338
2013-02-10Add %option noinput to a bunch of Flex files, as we aren't using theGuy Harris1-0/+10
input() routine and thus don't need to have it generated - and as it produces warnings of a routine defined but not used, we don't want to have it generated. Squelch a casting-const-away warning. svn path=/trunk/; revision=47613
2013-02-08Constify the return value of append_to_buffer(), to squelch someGuy Harris1-2/+2
warnings. svn path=/trunk/; revision=47559
2012-12-05Fix numerous instances of a variable/parameter name "shadowing" a library ↵Bill Meier1-5/+5
function name; (At least some (gcc ?) compilers give a "shadow" warning for these). svn path=/trunk/; revision=46402
2012-10-10In the include processing code, if ddict_open() fails, bail outGuy Harris1-3/+8
*regardless* of whether errno is non-zero, so we at least report the failure. In the standalone test program built if TEST_DIAM_DICT_STANDALONE is defined, check for ddict_scan() failing. Part of fix for bug 7824. svn path=/trunk/; revision=45452
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-2/+0
svn path=/trunk/; revision=45016
2011-06-28Replace all strerror() with g_strerror().Stig Bjørlykke1-1/+1
Remove our local strerror implementation. Mark strerror as locale unsafe API. This fixes bug 5715. svn path=/trunk/; revision=37812
2011-05-06Huzaifa Sidhpurwala of Red Hat Security Response Team discovered that weGerald Combs1-4/+2
could dereferene a NULL pointer if we had a corrupted Diameter dictionary. Additionally, it was possible to push an invalid input buffer onto the include stack. svn path=/trunk/; revision=37011
2010-05-13From Tamas Regos via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4760 :Jeff Morriss1-3/+3
Harmless typo bug in diam_dict.l applictation_start <-> application_start svn path=/trunk/; revision=32783
2009-10-29From Eric Sesterhenn via bug 4175:Stig Bjørlykke1-1/+1
Use g_strdup to allocate filename. svn path=/trunk/; revision=30755
2009-04-08Just use g_strdup_printf() to construct a pathname - and useGuy Harris1-9/+2
G_DIR_SEPARATOR_S as the pathname component separator. svn path=/trunk/; revision=28013
2009-04-08Disable warnings-as-errors for Flex-generated output. Add a couple of gsizeGerald Combs1-1/+1
casts. svn path=/trunk/; revision=28002
2009-02-07#include <epan/emem.h> not req'd ...Bill Meier1-1/+0
svn path=/trunk/; revision=27391
2008-08-05luis.ontanon@gmail.com => luis@ontanon.orgLuis Ontanon1-1/+1
svn path=/trunk/; revision=25937
2008-05-22Move the file utility functions from wiretap to libwsutil so thatJeff Morriss1-3/+3
libwireshark (and the plugins using those functions) do not depend on wiretap on Windows. While doing that, rename the eth_* functions to ws_*. svn path=/trunk/; revision=25354
2008-04-25 Bug 2493: Fix (Part 2): Bill Meier1-10/+11
To prevent Windows compiler errors when using flex 2.5.35. Fixes "missing unistd.h" and yywrap "mismatched parameter" warnings [Upcoming Part 3: ignore 'signed /unsigned mismatch' errors] svn path=/trunk/; revision=25173
2007-10-16Change more fopen() to eth_fopen() to finish fixing bug 1827:Jeff Morriss1-79/+80
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1827 Update README.developer to tell developers not to use fopen() and friends directly. svn path=/trunk/; revision=23206
2007-08-04Add a script as a front-end for Flex, to work around various problems,Guy Harris1-0/+1
such as the fact that Flex strips all but the last component of the "-o" argument, and that it doesn't generate a header file to declare routines the generated lexical analyzer defines. Use that script when building lexical analyzers, and, for each lexical analyzer, include the generated header file in the generated analyzer. svn path=/trunk/; revision=22446
2007-07-30Add comments to various %option items to explain what they're doing. Guy Harris1-4/+28
Move the %options to the beginning if they weren't already there, and put them in the same order in all files. Add "prefix=" options to .l files that don't already have them, so we don't have to pass a "-P" option. Add "never-interactive" and "noyywrap" options to our lexical analyzers, to remove extra isatty() checks and to eliminate the need for yywrap() from the Flex library. Get rid of %option nostdinit - that's the default. Add .l.c: rules to Makefile.am files, replacing the rules for specific .l files. Have those rules all check that $(LEX) is set. Update the address for the FSF. svn path=/trunk/; revision=22424
2007-07-20- <?avp-proto and <?type-proto to instruct about which dissector to use for ↵Luis Ontanon1-19/+48
a given type or avp - dissect timestamps - add all the avps that were commented out in the dictionary svn path=/trunk/; revision=22360
2007-07-18Initialise description field to avoid crash when dumping dictionary.Martin Mathieson1-0/+1
svn path=/trunk/; revision=22351