Fix &raw_output and enable_raw_output interpretation of NUL characters

When using a `print` statement to write to a file that has raw output
enabled, NUL characters in string are no longer interpreted into "\0",
no newline is appended afterwards, and each argument to `print` is
written to the file without any additional separation.

(Re)Assigning to identifiers with the &raw_output attribute should also
now correctly apply the attribute to the file value being assigned.

Note that the write_file BiF should already be capable of raw string
data to a file, expect it bypasses the print_hook event.

Addresses #474
This commit is contained in:
Jon Siwek 2011-08-03 10:51:40 -05:00
parent 6c806b0bce
commit 648e1bda26
12 changed files with 108 additions and 21 deletions

View file

@ -2385,7 +2385,7 @@ bool RemoteSerializer::FlushPrintBuffer(Peer* p)
return true;
}
bool RemoteSerializer::SendPrintHookEvent(BroFile* f, const char* txt)
bool RemoteSerializer::SendPrintHookEvent(BroFile* f, const char* txt, size_t len)
{
loop_over_list(peers, i)
{
@ -2398,8 +2398,6 @@ bool RemoteSerializer::SendPrintHookEvent(BroFile* f, const char* txt)
if ( ! fname )
continue; // not a managed file.
size_t len = strlen(txt);
// We cut off everything after the max buffer size. That
// makes the code a bit easier, and we shouldn't have such
// long lines anyway.