Commit Graph

20 Commits

Author SHA1 Message Date
Guy Harris 22d9288594 In "get_unicode_or_ascii_string()", treat a negative length argument as
a very large unsigned integer (which it probably is), and trim it at
INT_MAX, and fix the handling of too-long ASCII strings so that the
"..." gets inserted.  Make sure that all the bytes of the string exist
before truncating the string length to the buffer length, so that the
appropriate exception is thrown.

svn path=/trunk/; revision=10548
2004-04-03 03:50:44 +00:00
Ulf Lamping 0d9679de8d removed some MSVC warnings (level 3)
svn path=/trunk/; revision=9561
2004-01-05 19:31:44 +00:00
Guy Harris ee97ce3196 Add new routines:
tvb_get_string() - takes a tvbuff, an offset, and a length as
	arguments, allocates a buffer big enough to hold a string with
	the specified number of bytes plus an added null terminator
	(i.e., length+1), copies the specified number of bytes from the
	tvbuff, at the specified offset, to that buffer and puts in a
	null terminator, and returns a pointer to that buffer (or throws
	an exception before allocating the buffer if that many bytes
	aren't available in the tvbuff);

	tvb_get_stringz() - takes a tvbuff, an offset, and a pointer to
	a "gint" as arguments, gets the size of the null-terminated
	string starting at the specified offset in the tvbuff (throwing
	an exception if the null terminator isn't found), allocates a
	buffer big enough to hold that string, copies the string to that
	buffer, and returns a pointer to that buffer and stores the
	length of the string (including the terminating null) in the
	variable pointed to by the "gint" pointer.

Replace many pieces of code allocating a buffer and copying a string
with calls to "tvb_get_string()" (for one thing, "tvb_get_string()"
doesn't require you to remember that the argument to
"tvb_get_nstringz0()" is the size of the buffer into which you're
copying the string, which might be the length of the string to be copied
*plus 1*).

Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string).  Use "tvb_get_stringz()", instead.

In some cases where a value is fetched but is only used to pass an
argument to a "proto_tree_add_XXX" routine, use "proto_tree_add_item()"
instead.

svn path=/trunk/; revision=7859
2003-06-12 08:33:32 +00:00
Tim Potter 2b39831b5b Move the ntlmv2 response dissection out of packet-ntlmssp.c and in to
packet-smb-common.c so it can be used elsewhere.

Dissect a ntlmv2 response in a session setup SMB if detected.

svn path=/trunk/; revision=7655
2003-05-09 01:41:28 +00:00
Tim Potter efa0460d9c Add an extra argument to get_unicode_string() to optionally
pass back string data.

Start adding some COL_INFO tidbits for NETLOGON PDC query and PDC
query response.

svn path=/trunk/; revision=7399
2003-04-03 02:57:48 +00:00
Tim Potter dd038966d7 Add an extra argument to get_ms_string() so we can optionally pass
back the value of the string to the caller.

svn path=/trunk/; revision=7398
2003-04-03 02:22:30 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Guy Harris 2cfb231081 From Devin Heitmueller: dissect NTLMSSP authentication messages, and handle
the flags field in NTLMSSP messages as a 32-bit field.

Make "get_unicode_or_ascii_string()" take a "Unicode or not" flag rather
than a "packet_info *" as an argument, make it not static, and move it
to "packet-smb-common.c", so that it can be used by the SMB dissector
and the NTLMSSP dissector.  Also get rid of some _U_'s that are applied
to arguments that are, in fact, used.

svn path=/trunk/; revision=5976
2002-08-10 21:15:37 +00:00
Guy Harris 561aaa66e0 Fix "display_unicode_string()" to get the length of the Unicode string,
allocate a buffer big enough to hold the ASCIIfied version of that
string, and then ASCIIfy the Unicode string into that buffer, rather
than ASCIIfying into a fixed-length buffer.

svn path=/trunk/; revision=5676
2002-06-16 00:39:30 +00:00
Richard Sharpe 1303868b7d Account for hidden share types in share_types.
svn path=/trunk/; revision=5572
2002-05-27 04:11:06 +00:00
Guy Harris 500c93ee8e Move the value_string table for the share type values to
"packet-smb-common.c", and use it in "packet-dcerpc-srvsvc".

svn path=/trunk/; revision=5545
2002-05-24 10:57:38 +00:00
Guy Harris da74615c79 Get rid of some unused arguments, and mark some others as unused.
Remove the declaration of "dissect_nt_sid()" from
"packet-dcerpc-samr.c"; get it by including "packet-smb-common.h",
instead.

svn path=/trunk/; revision=5313
2002-04-30 11:03:08 +00:00
Guy Harris eb2d6593dc Replace a bunch of "tvb_length()" and "tvb_length_remaining()" calls in
arguments to "proto_tree_add_text()", and to "proto_tree_add_XXX()" calls
that add FT_NONE or FT_PROTO items to the protocol tree, with -1.

Replace some calls to "tvb_length()" or "tvb_length_remaining()" with
calls to "tvb_reported_length()" and "tvb_reported_length_remaining()",
as those give the actual length of the data in the packet, not just the
data that happened to be captured.

svn path=/trunk/; revision=4605
2002-01-24 09:20:54 +00:00
Guy Harris bf877ca5c5 Get rid of incorrect "const" qualifier.
svn path=/trunk/; revision=3664
2001-07-08 20:38:26 +00:00
Guy Harris a3137abdee Use tvbuff-based routines to find the length of single-bit-character-set
strings.

svn path=/trunk/; revision=3662
2001-07-08 19:26:33 +00:00
Guy Harris d47dac785e Tvbuffified SMB NETLOGON dissector, from Ronnie Sahlberg.
Fixed up some longstanding bugs (predating the tvbuffification)
discovered during regression testing of the tvbuffification.

svn path=/trunk/; revision=3661
2001-07-08 11:32:02 +00:00
Gilbert Ramirez 292e38e2c6 Add tvbuff class.
Add exceptions routines.
Convert proto_tree_add_*() routines to require tvbuff_t* argument.
Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as
the tvbuff_t* argument to proto_tree_add_*() routines.

dissect_packet() creates a tvbuff_t, wraps the next dissect call in
a TRY block, will print "Short Frame" on the proto_tree if a BoundsError
exception is caught.

The FDDI dissector is converted to use tvbuff's.

svn path=/trunk/; revision=1939
2000-05-11 08:18:09 +00:00
Guy Harris d530dd8643 In "display_flags()", panic if the size handed to it is neither 1, 2,
nor 4, as we currently don't handle that.

svn path=/trunk/; revision=1634
2000-02-14 04:22:22 +00:00
Guy Harris ec092f8c9d Fix the comment at the beginning of the file.
svn path=/trunk/; revision=1630
2000-02-14 04:05:53 +00:00
Guy Harris 12df8af4e3 Jeff Foster's SMB Mailslot and Netlogin dissectors; he split
"packet-smb.c" up into several files.

svn path=/trunk/; revision=1629
2000-02-14 04:02:21 +00:00