Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Validate max_hits before parsing as integer.

kishorenc6b754ec37b8d
diff --git a/src/core_api.cpp b/src/core_api.cpp
index 3a7c939f..61c4350d 100644
--- a/src/core_api.cpp
+++ b/src/core_api.cpp
@@ -347,6 +347,11 @@ bool get_search(http_req & req, http_res & res) {
return false;
}
+ if(!StringUtils::is_uint64_t(req.params[MAX_HITS])) {
+ res.set_400("Parameter `" + std::string(MAX_HITS) + "` must be an unsigned integer.");
+ return false;
+ }
+
std::string filter_str = req.params.count(FILTER) != 0 ? req.params[FILTER] : "";
std::vector<std::string> search_fields;