Commit Graph

5617 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
f052d2b396 Clean up whitespaces 2018-10-27 19:17:38 +02:00
Francois-Xavier Le Bail
62658c17d2 Remove a space (style)
Moreover:
Fix indentation.
2018-10-27 16:51:30 +02:00
Guy Harris
1c30d69b97 Fix nd_snprintf(buf, buflen, "string");
If this is VS prior to 2015 or MinGW, we can't trust snprintf(); we have
to use _snprintf_s(), but that requires us to insert _TRUNCATE as an
argument after the buffer and buffer length and before the format string
and arguments, if any, to the format string.

That means we need to use a vararg macro; however, if we make the format
string a regular argument to the macro, that means that, if there are no
arguments *after* the format string, you end up with an argument list to
_snprintf_s() that ends with "fmt, ", and that's not valid C.

*If* we knew this was GCC or Clang, we could use a GNU C-specific hack,
wherein, if __VA_ARGS__ is preceded by ## and there's a comma before
that, the comma is removed if __VA_ARGS__ is empty, but this might be
Microsoft's C compiler in a version of Visual Studio prior to VS 2015,
which might not support that.

So we have to just have the macro take, as the ... arguments, the format
string and its arguments.

Addresses GitHub issue #713.
2018-10-13 22:51:54 -07:00
Guy Harris
f3c200c36c Clean up indentation. 2018-10-10 15:26:49 -07:00
Guy Harris
59b59d83fb
Merge pull request #710 from agnosticdev/return-checks
return-checks: Added a return check for malloc and for strsep
2018-10-09 01:02:45 -07:00
agnosticdev
50301a252f return-checks: Added a return check for malloc and for strsep 2018-10-08 21:18:52 -05:00
Francois-Xavier Le Bail
51eefc7c84 man page: Update the -ttt and -ttttt options sections
The delta is printed with microsecond or nanosecond resolution depending
on the --time-stamp-precision option (default is microsecond resolution).
2018-10-05 15:49:14 +02:00
Francois-Xavier Le Bail
466113cdb4 Harmonize a message
s/capture size/snapshot length/

It's a follow-up to 8a54b2483b.
2018-10-05 09:35:31 +02:00
Francois-Xavier Le Bail
8a54b2483b Add the snapshot length to the "reading from file ..." message 2018-10-04 22:11:12 +02:00
Francois-Xavier Le Bail
14f0354db1 Use signed formats for signed values 2018-10-04 16:26:42 +02:00
Guy Harris
db5d2216a6
Merge pull request #707 from herwinw/cleanup_win32_GNUMakefile
Fix tab/spaces in GNUmakefile of win32
2018-10-03 13:11:28 -07:00
Herwin Weststrate
a4e008c5c4 Change unknown attribute in test
The value 127 is actually assigned to the Location-Information Attribute
(RFC 5580). Change it to a very high value.
2018-10-03 21:15:25 +02:00
Herwin Weststrate
df511af670 Fix tab/spaces in GNUmakefile of win32 2018-10-03 20:23:20 +02:00
Francois-Xavier Le Bail
0175075ccd Remove unused TCP ports 2018-10-02 19:27:08 +02:00
Guy Harris
ca94c264bf
Merge pull request #704 from nmap/win32-isatty
Ensure isatty is defined on Win32.
2018-10-02 09:48:02 -07:00
Francois-Xavier Le Bail
1f3edd71d9 Remove unused UDP ports 2018-10-02 16:55:57 +02:00
Daniel Miller
30618d8d9a Ensure isatty is defined on Win32. 2018-10-02 09:52:40 -05:00
Daniel Miller
063644a4c5 Update .gitignore for other configurations 2018-10-01 22:14:14 -05:00
Daniel Miller
1f28b3f05f Add files generated by CMake on Windows to .gitignore 2018-10-01 22:08:01 -05:00
Francois-Xavier Le Bail
55f499c9eb SLIP: Remove printing the raw hex dump of the compressed header
ndo_nflag has not this function. We don't currently have an appropriate
flag for this use. Not sure printing the header in hex is currently useful.

Update the output of a test accordingly.
2018-09-25 22:21:09 +02:00
Francois-Xavier Le Bail
ebf60e3cce Add a nd_print_trunc() call 2018-09-24 21:42:08 +02:00
Francois-Xavier Le Bail
0446070756 ICMPv6: Fix some truncation codes 2018-09-24 07:44:46 +02:00
Francois-Xavier Le Bail
62b2632f35 IP6OPTS: Fix some truncation codes
Moreover:
Update the output of some tests accordingly.
Fix style.
2018-09-24 07:44:46 +02:00
Guy Harris
58d3d6c9f6 Update a test file.
The bug fix in ccd4a6b3b9 means we
correctly set the packet length to be the PDU length, so we can check
the checksum.
2018-09-23 19:15:10 -07:00
Guy Harris
1dbc62cb83 Clean up some narrowing warnings.
Cast pointer differences, widen some variables, make some function
returns unsigned as they never return a negative number.

Fix a format while we're at it.
2018-09-23 18:09:56 -07:00
Guy Harris
ccd4a6b3b9 Fix the variable for the packet length.
The length passed in is a u_int, so we should assign it to a u_int, not
a u_short.
2018-09-23 18:02:37 -07:00
Francois-Xavier Le Bail
bbe15da782 SLIP: Add some bounds checks
This should fix GitHub issues #676 and #677.
2018-09-22 16:25:59 +02:00
Francois-Xavier Le Bail
dcea6d0284 Update a comment 2018-09-22 15:19:44 +02:00
Francois-Xavier Le Bail
d80d56eec3 IP: Simplify an expression 2018-09-22 12:46:36 +02:00
Guy Harris
e45d9a02dc
Merge pull request #701 from loganaden/master
Update my email address
2018-09-21 20:29:09 -07:00
Loganaden Velvindron
877d7e07fd Update my email address 2018-09-22 07:23:04 +04:00
Guy Harris
3eec801c5a Reorganize the dissection code a bit.
Get rid of the global nfserr variable and, instead, have it be local to
interp_reply().  That means one less global variable, which may be good
if any multi-threaded program tries to use libnetdissect in more than
one thread (there are still global variables that would have to be
removed), and gets rid of some cases where we didn't need to set it.

Don't bundle multiple operations inside an if clause.  This squelches
some warnings from MSVC, and makes the code a bit more uniform and a bit
easier to understand (and, in the process of doing that, found a bug
that was fixed in 596aca3d93).
2018-09-18 00:07:24 -07:00
Guy Harris
596aca3d93 Fix dissection of NFSv3 WRITE and LINK replies.
Don't report them all as truncated if -v isn't specified.
2018-09-16 08:33:38 -07:00
Guy Harris
000261d112 That wasn't correct. 2018-09-16 00:12:57 -07:00
Guy Harris
8896cbdc54 Clean up the name resolution a bit.
If we're not doing name-to-address resolution, don't bother with the
address-to-name table.
2018-09-15 19:14:24 -07:00
Guy Harris
9008c09c88 Don't warn about declarations after statements.
We now allow them, and require a compiler that supports them, so there's
no need to warn about them.
2018-09-15 13:16:02 -07:00
Guy Harris
b6e38e7c52 Don't warn about declarations after statements.
We now allow them, and require a compiler that supports them, so there's
no need to warn about them.
2018-09-15 13:12:49 -07:00
Francois-Xavier Le Bail
0e8826d5fb Add more nd_print_trunc() calls 2018-09-15 17:48:07 +02:00
Guy Harris
4c1c6e8293 Fix data types.
If you're accumulating the lengths of strings, as returned by strlen(),
and passing the result to malloc(), it should be accumulated in a
size_t.
2018-09-15 01:41:59 -07:00
Guy Harris
89576203dd Move getopt_long.h to missing.
That's what we did for win_ether_ntohost.h.
2018-09-14 19:21:06 -07:00
Guy Harris
ec11595998 Revert "Clean up the code a bit."
This reverts commit a5eca2cbbf.

MSVC doesn't complain about it, so leave it alone.
2018-09-14 18:05:55 -07:00
Guy Harris
a5eca2cbbf Clean up the code a bit.
This eliminates a warning from MSVC, and makes the flow a little
clearer.

(Yes, it duplicates some code, but compilers have been pretty good at
merging common code sequences, so it might just turn it into the
equivalent of

	if (optopt == (int)':')
		goto label;
	oli = strchr(ostr, optopt);
	if (!oli) {
	label:
		/*
		 * Unknown option character.
		 */
		if (!*place)
			++optind;

		...
	}

although it does mean that the same C code exists in two places.)
2018-09-14 17:48:45 -07:00
Francois-Xavier Le Bail
3ad93074c1 BGP: Fix an error string
"[|" is the prefix for a truncated string. This is not the case here.
2018-09-14 21:48:35 +02:00
Francois-Xavier Le Bail
3976533f2c Remove some useless tests
Because packet length (length) >= capture length (caplen).

(see the sanity checks in print.c, pretty_print_packet() function)
2018-09-14 18:04:38 +02:00
Guy Harris
6795da23af See if a newer MSVC will produce fewer warnings.
Some of the narrowing warnings are false positives; newer versions of
Clang do a better job than older ones of determining the range of values
of expressions, and don't warn if the range is such that it can be
safely narrowed, so maybe the same is true of MSVC.
2018-09-13 19:19:38 -07:00
Guy Harris
7c36677950 Do parallel builds, run as a developer.
Tell msbuild to build in parallel.  Use Windows syntax for command-line
flags.  Create the .devel file.
2018-09-13 17:14:23 -07:00
Guy Harris
e5c7dcdc04 Try to find the 64-bit libraries in a 64-bit build. 2018-09-13 16:26:39 -07:00
Guy Harris
5d5a9021b5 Do both 32-bit and 64-bit builds. 2018-09-13 16:09:51 -07:00
Francois-Xavier Le Bail
4f1cc2f3e3 Add a nd_print_trunc() call 2018-09-13 21:42:20 +02:00
Francois-Xavier Le Bail
e67f4fcae8 Add more nd_print_trunc() calls 2018-09-13 21:16:44 +02:00