If the uncompression buffers are empty, they have no data; set the count
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 1 Jan 2014 23:22:53 +0000 (23:22 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 1 Jan 2014 23:22:53 +0000 (23:22 +0000)
of bytes in them to 0, as there's no data in them, and set the offset in
that buffer of the stream's current position, to 0, as we're currently
at the beginning of the file in both streams.

This fixes some tricky-to-reproduce errors (which show up only if the
ngsniffer_t structure is allocated from data that's been allocated,
written to in those variables, and freed).

#BACKPORT 1.8, 1.10

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@54544 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/ngsniffer.c

index 9c1862350413d80bbdb22cd6110ea9b698a36fb1..c41da046f565e6fa0733d6130d23c2d150c6b1b8 100644 (file)
@@ -740,7 +740,11 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
 
        /* We haven't allocated any uncompression buffers yet. */
        ngsniffer->seq.buf = NULL;
+       ngsniffer->seq.nbytes = 0;
+       ngsniffer->seq.nextout = 0;
        ngsniffer->rand.buf = NULL;
+       ngsniffer->rand.nbytes = 0;
+       ngsniffer->rand.nextout = 0;
 
        /* Set the current file offset; the offset in the compressed file
           and in the uncompressed data stream currently the same. */