lib/pcap: Use ofpbuf_tail() instead of ofpbuf_end().
authorJarno Rajahalme <jrajahalme@nicira.com>
Tue, 25 Mar 2014 22:26:23 +0000 (15:26 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Tue, 25 Mar 2014 22:26:23 +0000 (15:26 -0700)
Using ofpbuf_end() to compute payload length would fail if the ofpbuf
had any tailroom.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/pcap-file.c

index 2d3f9fe..e2fd203 100644 (file)
@@ -311,7 +311,7 @@ tcp_reader_run(struct tcp_reader *r, const struct flow *flow,
     }
     tcp = packet->l4;
     flags = TCP_FLAGS(tcp->tcp_ctl);
-    l7_length = (char *) ofpbuf_end(packet) - (char *) packet->l7;
+    l7_length = (char *) ofpbuf_tail(packet) - (char *) packet->l7;
     seq = ntohl(get_16aligned_be32(&tcp->tcp_seq));
 
     /* Construct key. */