aboutsummaryrefslogtreecommitdiffstats
path: root/packet-lpd.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-08-25 17:38:36 +0000
committerGuy Harris <guy@alum.mit.edu>1999-08-25 17:38:36 +0000
commit27e81cb483bd29b6760256ca93ab601264ccc2a8 (patch)
tree37434ab94616cf1d6f213619d806818dea9247fa /packet-lpd.c
parentadf5b4881ca29641936aa53a5f055d67182ee9b5 (diff)
Use END_OF_FRAME rather than "fd->cap_len - offset" - END_OF_FRAME used
to be just "fd->cap_len - offset", but it's now "pi.captured_len - offset", which means that, for a protocol built atop TCP, like LPD, it'll take into account the fact that the IP (and thus TCP) data in the packet may end before the end of the frame. svn path=/trunk/; revision=579
Diffstat (limited to 'packet-lpd.c')
-rw-r--r--packet-lpd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/packet-lpd.c b/packet-lpd.c
index e4718488fb..016076cfe0 100644
--- a/packet-lpd.c
+++ b/packet-lpd.c
@@ -2,7 +2,7 @@
* Routines for LPR and LPRng packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-lpd.c,v 1.8 1999/07/07 22:51:47 gram Exp $
+ * $Id: packet-lpd.c,v 1.9 1999/08/25 17:38:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -93,7 +93,7 @@ dissect_lpd(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
}
if (tree) {
- ti = proto_tree_add_text(tree, offset, fd->cap_len - offset,
+ ti = proto_tree_add_text(tree, offset, END_OF_FRAME,
"Line Printer Daemon Protocol");
lpd_tree = proto_item_add_subtree(ti, ETT_LPD);
@@ -109,10 +109,11 @@ dissect_lpd(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
printer = g_strdup(&pd[offset+1]);
/* get rid of the new-line so that the tree prints out nicely */
- if (printer[fd->cap_len - offset - 2] == 0x0a) {
- printer[fd->cap_len - offset - 2] = 0;
+ if (printer[END_OF_FRAME - 2] == 0x0a) {
+ printer[END_OF_FRAME - 2] = 0;
}
- proto_tree_add_text(lpd_tree, offset+1, fd->cap_len - (offset+1),
+ proto_tree_add_text(lpd_tree, offset+1,
+ END_OF_FRAME - 1,
/*"Printer/options: %s", &pd[offset+1]);*/
"Printer/options: %s", printer);
g_free(printer);
@@ -126,11 +127,11 @@ dissect_lpd(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
printer = strdup(&pd[offset]);
line_pos = printer;
curr_offset = offset;
- while (fd->cap_len > curr_offset) {
+ while (pi.captured_len > curr_offset) {
newline = strchr(line_pos, '\n');
if (!newline) {
proto_tree_add_text(lpd_tree, curr_offset,
- fd->cap_len - offset, "Text: %s", line_pos);
+ END_OF_FRAME, "Text: %s", line_pos);
break;
}
*newline = 0;