1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

Kernel: When validating a string read, validate the pointer first.

Calling strlen() on an invalid pointer is just gonna crash the process.
This commit is contained in:
Andreas Kling 2019-02-08 00:10:01 +01:00
parent 887b4a7a1a
commit f4bce03716
2 changed files with 8 additions and 1 deletions

View file

@ -267,7 +267,7 @@ public:
bool validate_read(const void*, size_t) const;
bool validate_write(void*, size_t) const;
bool validate_read_str(const char* str) { return validate_read(str, strlen(str) + 1); }
bool validate_read_str(const char* str);
template<typename T> bool validate_read_typed(T* value, size_t count = 1) { return validate_read(value, sizeof(T) * count); }
template<typename T> bool validate_write_typed(T* value, size_t count = 1) { return validate_write(value, sizeof(T) * count); }