mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Proof of Concept on Bugprone Narrowing Conversions: Base64
This commit is contained in:
parent
8ba19cd7d1
commit
cad6f881eb
3 changed files with 24 additions and 20 deletions
11
src/Base64.h
11
src/Base64.h
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#ifndef base64_h
|
||||
#define base64_h
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
@ -30,10 +31,10 @@ public:
|
|||
// input bytes processed, since the decoding will stop when there
|
||||
// is not enough output buffer space.
|
||||
|
||||
int Decode(int len, const char* data, int* blen, char** buf);
|
||||
void Encode(int len, const unsigned char* data, int* blen, char** buf);
|
||||
size_t Decode(size_t len, const char* data, size_t* pblen, char** buf);
|
||||
void Encode(size_t len, const unsigned char* data, size_t* blen, char** buf);
|
||||
|
||||
int Done(int* pblen, char** pbuf);
|
||||
int Done(size_t* pblen, char** pbuf);
|
||||
int HasData() const { return base64_group_next != 0; }
|
||||
|
||||
// True if an error has occurred.
|
||||
|
@ -70,3 +71,5 @@ protected:
|
|||
|
||||
BroString* decode_base64(const BroString* s, const BroString* a = 0, Connection* conn = 0);
|
||||
BroString* encode_base64(const BroString* s, const BroString* a = 0, Connection* conn = 0);
|
||||
|
||||
#endif /* base64_h */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue