# BinPAC &restofflow

**URL:** <https://community.zeek.org/t/binpac-restofflow/2277>\
**Category:** Development\
**Tags:** development\
**Created:** [April 3, 2012, 7:55pm UTC](https://community.zeek.org/t/binpac-restofflow/2277 "2012-04-03T19:55:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Thompson](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Matt\_Thompson](https://community.zeek.org/u/Matt_Thompson)\
**Post date:** [April 3, 2012, 7:55pm UTC](https://community.zeek.org/t/binpac-restofflow/2277/1 "2012-04-03T19:55:26Z")

</div>

Hi,

I've been trying to get &restofflow to work in BinPAC.

Here is a simple .pac file: [http://pastebin.com/tmYgnXkd](http://pastebin.com/tmYgnXkd)  
And the code to call it: [http://pastebin.com/2rA3KuU1](http://pastebin.com/2rA3KuU1)

With the input file

HEADER  
body

I would expect that body\_done() and message\_done() would be called (but  
they aren't).

TEST\_Flow::FlowEOF() is calling set\_eof() in the upstream FlowBuffer  
which sets frame\_length\_ = 5 (correct for 'body' + '\n'.)

It then calls NewData(0,0) (NULL start/end pointers). The  
orig\_data\_begin\_ and orig\_data\_end\_ pointers get squashed and no data is  
passed back to the TEST\_Body::ParseBuffer().

In FlowBuffer::NewData(), if I add if(begin != NULL) { } around  
everything before MarkOrCopy(), things work as expected. I'm not sure if  
this is the place to fix this bug or if I'm just doing something wrong  
so would like to get some feedback on this.

Regards,  
Matt Thompson

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:40pm UTC](https://community.zeek.org/t/binpac-restofflow/2277/2 "2022-05-06T15:40:17Z")

</div>


