mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Base64: report byte as positive integer
A baseline difference between arm64 and x86 showed up. We would print a wrong character as negative value on x86 due to chars being signed by default. Force an unsigned interpretation which is also more reasonable because we'd have never indexed the base64 table with -112 -XXXXXXXXXX.XXXXXX XXXXXXXXXXX 131.243.99.154 3288 193.159.183.138 80 base64_illegal_encoding character -112 ignored by Base64 decoding F zeek - +XXXXXXXXXX.XXXXXX XXXXXXXXXXX 131.243.99.154 3288 193.159.183.138 80 base64_illegal_encoding character 144 ignored by Base64 decoding F zeek - Fixes more of #2742
This commit is contained in:
parent
c998cf697a
commit
5dc54fb40e
3 changed files with 22 additions and 4 deletions
|
@ -184,17 +184,17 @@ int Base64Converter::Decode(int len, const char* data, int* pblen, char** pbuf)
|
|||
if ( dlen >= len )
|
||||
break;
|
||||
|
||||
if ( data[dlen] == '=' )
|
||||
unsigned char c = (unsigned char)data[dlen];
|
||||
if ( c == '=' )
|
||||
++base64_padding;
|
||||
|
||||
int k = base64_table[(unsigned char)data[dlen]];
|
||||
int k = base64_table[c];
|
||||
if ( k >= 0 )
|
||||
base64_group[base64_group_next++] = k;
|
||||
else
|
||||
{
|
||||
if ( ++errored == 1 )
|
||||
IllegalEncoding(
|
||||
util::fmt("character %d ignored by Base64 decoding", (int)(data[dlen])));
|
||||
IllegalEncoding(util::fmt("character %d ignored by Base64 decoding", (int)c));
|
||||
}
|
||||
|
||||
++dlen;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue