From 0a87754c998326f5aeca5e72e2932e59813314e2 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 10 Apr 2021 17:39:48 -0700 Subject: [PATCH] ircd::gpt::vocab: Fix token init missing null terminations. --- ircd/gpt_vocab.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ircd/gpt_vocab.cc b/ircd/gpt_vocab.cc index e361a39a9..64f231885 100644 --- a/ircd/gpt_vocab.cc +++ b/ircd/gpt_vocab.cc @@ -120,7 +120,19 @@ ircd::gpt::vocab::init_tokens() for(const auto &[key, val] : json::object(vocab_json)) { assert(tokens == lex_cast(val)); - json::unescape(token[tokens++], key); + + auto &buf + { + token[tokens++] + }; + + const auto unescaped + { + json::unescape(buf, key) + }; + + for(size_t i(size(unescaped)); i < 16; ++i) + buf[i] = 0; } }