mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix string slice notation, addresses BIT-1097.
Slice ranges were not correctly determined for negative indices and also off by one in general (included one more element at the end of the substring than what actually matched the index range). It's now equivalent to Python slice notation. Accessing a string at a single index is also the same as Python except that an out-of-range index returns an empty string instead of throwing an expection.
This commit is contained in:
parent
dc52846b6f
commit
4014cdc277
4 changed files with 187 additions and 14 deletions
|
@ -60,7 +60,7 @@ event file_new(f: fa_file)
|
|||
if ( f?$bof_buffer )
|
||||
{
|
||||
print "FILE_BOF_BUFFER";
|
||||
print f$bof_buffer[0:10];
|
||||
print f$bof_buffer[0:11];
|
||||
}
|
||||
|
||||
if ( f?$mime_type )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue