RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix: add buffer-length check in text.c (CWE-120) (#20803)
Anupam Mediratta6ce25fbd6b2f
diff --git a/internal/binding/cpp/opencc/dictionary/text.c b/internal/binding/cpp/opencc/dictionary/text.cindex 84a65167a9..18e4018e01 100644--- a/internal/binding/cpp/opencc/dictionary/text.c+++ b/internal/binding/cpp/opencc/dictionary/text.c@@ -85,6 +85,12 @@ int parse_entry(const char *buff, entry *entry_i) {free(ucs4_buff);}+ /* value_i may equal value_count here (e.g. exactly a power-of-two+ * multiple of INITIAL_DICTIONARY_SIZE values on one line), which would+ * write the NUL terminator one slot past the end of the buffer below.+ * Grow the allocation to guarantee room for it. */+ if (value_i >= value_count)+ value_count = value_i + 1;entry_i->value = (ucs4_t **)realloc(entry_i->value, value_count * sizeof(ucs4_t *));entry_i->value[value_i] = NULL;