arangodb / velocypack

A fast and compact format for serialization and storage
Other
419 stars 40 forks source link

Input validation #43

Open siilike opened 5 years ago

siilike commented 5 years ago

I was wondering what would be the best way to perform input validation to avoid buffer overflows.

For instance, if the application receives a 10-byte message that is a binary VPack value with length set to 100 bytes.

jsteemann commented 5 years ago

There is a class named velocypack::Validator, which can be used for input validation. It has a validate method which should be given a pointer to the input plus the length of the input. There are several examples of how to use it in the tests.