Commit Graph

25 Commits

Author SHA1 Message Date
Guy Harris 57a1514ac7 Cast away the return value of g_strlcpy() and g_strlcat().
Most of the time, the return value tells us nothing useful, as we've
already decided that we're perfectly willing to live with string
truncation.  Hopefully this keeps Coverity from whining that those
routines could return an error code (NARRATOR: They don't) and thus that
we're ignoring the possibility of failure (as indicated, we've already
decided that we can live with string truncation, so truncation is *NOT*
a failure).
2021-04-30 03:19:19 -07:00
Gerald Combs f21cd2e23f wiretap: Convert ascend.y to Lemon.
Convert wiretap/ascend.y.in from Bison/YACC to Lemon and rename it to
wiretap/ascend_parser.lemon. Tighten up some of our scanning and
parsing. Make the indentation in it and related files consistent. Aside
from the recent IPv4 fragment offset changes, this produces identical
output to the 3.4 branch for the Ascend trace files I have here.

Remove the comment about supporting other commands. Another timeline
might have an Ascend that successfully pivoted to DSL or 15625B+1D
gigabit ISDN, but this one has neither.

This was our last/only Bison/YACC file, so remove Bison/YACC as a
development and packaging dependency and remove references to it from
the documentation.
2020-11-30 08:15:43 +00:00
Guy Harris 5428e8ddbe Fix handling of some ISDN calls.
There's no guarantee that there will be two digits after PRI-XMIT or
PRI-RCV; the capture file in bug 3535, for exmaple, has "PRI-XMIT-0/1"
and "PRI-RCV-0".

Require a minimum of 1, not 2, non-{/(:} characters.  Leave the maximum
of 20 in place.

Change-Id: Ie8f8f4ff5eb04baf0ee61bf28015e59a1fa43948
Reviewed-on: https://code.wireshark.org/review/29947
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-01 19:58:49 +00:00
Stig Bjørlykke 14720ace06 Fix comment end after SPDX identifier
Move */ to a separate line below the SPDX identifier.

Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f
Reviewed-on: https://code.wireshark.org/review/27211
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-01 06:56:37 +00:00
Guy Harris 72b57ac4ef Use DIAG_OFF_FLEX/DIAG_ON_FLEX more consistently.
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-16 19:54:16 +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
Dario Lombardo 9e3e02f5e5 wiretap: more SPDX license convertions.
Change-Id: I12695d0713b1d7fe58f09b2037303fab523085e9
Reviewed-on: https://code.wireshark.org/review/25394
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-20 17:17:58 +00:00
João Valverde 8615e78630 Disable flex-generated [-Wsign-compare] warnings
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-09-19 10:06:07 +00:00
Guy Harris 6f37317539 Include config.h at the very beginning of all Flex scanners.
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-12-02 21:02:10 +00:00
Guy Harris 1158576622 Don't pick up junk from an unset error-number variable.
Keep the actual error code and pointer-to-error-string in the scanner
state, rather than pointers to the variables passed in to us.
Initialize them to 0 and NULL, respectively.

That way, when the actual scanner routine returns, we don't check for an
error by looking at the error variable pointed to by our argument, which
might not have been set by the scanner and might have stack junk in it,
we look at a structure member we set to 0 before the scan.

Change-Id: I81a4fd6d5cf5e56f5638fae1253c48dc50c9c36d
Reviewed-on: https://code.wireshark.org/review/17721
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-16 01:32:47 +00:00
Guy Harris 368e3b8bd7 Set the extra type the right way.
Use %option extra_type= rather than #defining YY_EXTRA_TYPE.

Change comments to reflect that the state structure is used both by the
lexical analyzer and the parser.

Change-Id: I19a81de61cbd6e86d71154f376ef0681cc6d42fb
Reviewed-on: https://code.wireshark.org/review/14826
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-05 23:32:18 +00:00
Guy Harris 014d75116c Fix #defines.
Change-Id: I0fcd865d686d50ae9be17e97a4495daebc4bc4fc
Reviewed-on: https://code.wireshark.org/review/14801
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-03 22:43:04 +00:00
Guy Harris 59816ef00c Make the Flex scanners and YACC parser in libraries reentrant.
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-04-03 22:21:29 +00:00
Guy Harris f520f82750 Get rid of a bunch of unused variables.
("Unused" includes "set but not used".)

Change-Id: Id67859b366e8caa50262f8530630ec4e8ef1507a
Reviewed-on: https://code.wireshark.org/review/12457
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-06 23:40:08 +00:00
Guy Harris f51bad11d7 Use noyywrap rather than defining our own yywrap functions.
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-12-05 08:06:50 +00:00
Guy Harris 9d52712ed8 More unnecessary <stdio.h> includes.
libwiretap no longer uses standard I/O routines to read files; those
includes are left over from when it did.

Change-Id: Ia46c5e24ed25c6bd254cd271746ace539a37e590
Reviewed-on: https://code.wireshark.org/review/11634
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-08 01:26:49 +00:00
Guy Harris ce22578996 Don't include io.h in Flex scanners - they're not interactive.
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-11-06 01:14:31 +00:00
Guy Harris ffd48cefa6 Whitespace cleanups.
Change-Id: I92f983b2e04defab30eb31c14c484b9f0f582413
Reviewed-on: https://code.wireshark.org/review/4513
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07 05:01:39 +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
Gerald Combs 8fde85216a Squelch a bunch of shorten-64-to-32 warnings by parsing all of our
numeric values using strtoul and casting it the result to a guint32.
Hopefully no user or session IDs are negative or greater than 32 bits.

svn path=/trunk/; revision=54100
2013-12-14 18:07:01 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Guy Harris 06256dfe5b The only place where we care about zlib is file_wrappers.c; include
<zlib.h> there, rather than wtap-int.h.  That obviates the need to
include config.h earlier in ascend_scanner.l; revert the previous
change, so we don't require a version of Flex that supports %top.

svn path=/trunk/; revision=37640
2011-06-09 22:46:00 +00:00
Gerald Combs a47485acd9 Move the copyright notice and the config.h include to the top of the
file so that we have the proper definitions in place for large file
support on Solaris (bug 6102).

svn path=/trunk/; revision=37635
2011-06-09 21:13:40 +00:00
Gerald Combs 2eff7bab66 Limit the lengths of some of our patterns. Fixes an infinite loop found
when trying to read a TPNCP data file.

svn path=/trunk/; revision=37625
2011-06-08 20:58:44 +00:00
Jörg Mayer 0d300bb6f5 Rename all of the ascend files:
That way we hopefully won't need the runlex.sh hack any
more. Also the ylwrap stuff is (hopefully) obsolete.

ascend.[hc]      -> ascendtext.[hc]
ascend-scanner.l -> ascend_scanner.l
ascend-grammar.y -> ascend.y


svn path=/trunk/; revision=28744
2009-06-15 18:56:46 +00:00