mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/timw/1692-binary-to-int64-shifting'
* origin/topic/timw/1692-binary-to-int64-shifting: GH-1692: Add some safety to ASN's binary_to_int64 to avoid bad shifts
This commit is contained in:
commit
2a717e05cc
3 changed files with 13 additions and 1 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
||||||
|
4.2.0-dev.54 | 2021-07-29 13:23:51 -0700
|
||||||
|
|
||||||
|
* GH-1692: Add some safety to ASN's binary_to_int64 to avoid bad shifts (Tim Wojtulewicz, Corelight)
|
||||||
|
|
||||||
4.2.0-dev.50 | 2021-07-27 09:36:13 -0700
|
4.2.0-dev.50 | 2021-07-27 09:36:13 -0700
|
||||||
|
|
||||||
* Fix a use-after-free during shutdown (Tim Wojtulewicz, Corelight)
|
* Fix a use-after-free during shutdown (Tim Wojtulewicz, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
4.2.0-dev.50
|
4.2.0-dev.54
|
||||||
|
|
|
@ -87,10 +87,18 @@ type Array = record {
|
||||||
|
|
||||||
############################## ASN.1 Conversion Functions
|
############################## ASN.1 Conversion Functions
|
||||||
|
|
||||||
|
# Converts an 8-byte string into an int64. If this string is longer than
|
||||||
|
# 8 bytes, it reports a weird and returns zero.
|
||||||
function binary_to_int64(bs: bytestring): int64
|
function binary_to_int64(bs: bytestring): int64
|
||||||
%{
|
%{
|
||||||
int64 rval = 0;
|
int64 rval = 0;
|
||||||
|
|
||||||
|
if ( bs.length() > 8 )
|
||||||
|
{
|
||||||
|
zeek::reporter->Weird("asn_binary_to_int64_shift_too_large", zeek::util::fmt("%d", bs.length()));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for ( int i = 0; i < bs.length(); ++i )
|
for ( int i = 0; i < bs.length(); ++i )
|
||||||
{
|
{
|
||||||
uint64 byte = bs[i];
|
uint64 byte = bs[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue