aboutsummaryrefslogtreecommitdiffstats
path: root/packet-fix.c
AgeCommit message (Collapse)AuthorFilesLines
2003-06-12Add new routines:Guy Harris1-7/+5
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-12Heuristic dissectors are not allowed to return FALSE after they've doneGuy Harris1-33/+38
something to the protocol tree or the columns, as that leaves crud in the protocol tree that could mess up whatever stuff subsequent dissection code does with the packet. Get rid of all column-setting code before the initial sanity checking code, and have that code just return FALSE rather than putting "Malformed FIX Packet" indications (if the dissector returns FALSE, it's saying the packet *isn't* a FIX packet, not that it is one but that it's malformed). After we've set the columns and created the protocol tree, return TRUE if we find a problem (we should put an error indication there in that case). svn path=/trunk/; revision=7857
2003-06-10As "tvb_strneql()" and "tvb_memeql()" now just return -1, rather thanGuy Harris1-2/+2
throwing an exception, if the bytes to be compared aren't available in the tvbuff, we don't need to check for their existence before calling those routines. svn path=/trunk/; revision=7826
2003-05-19More tvb_get_nstringz0() fixes. Timo Sirainen pointed out that BadGerald Combs1-1/+7
Things can happen if we pass a zero buffer length to tvb_get_nstringz0(). Throw an exception if this happens. In various dissectors make sure the tvb_get_nstringz0()'s buffer length is greater than zero. svn path=/trunk/; revision=7688
2003-04-30Modify tvb_get_nstringz*() to behave more like snprintf(). Make changesGerald Combs1-4/+4
where necessary to reflect the new behavior. svn path=/trunk/; revision=7607
2002-09-16New dissector for the FIX protocol by PC DrewJörg Mayer1-0/+6256
svn path=/trunk/; revision=6298