From 63790757ebc36f9de716b1a807435046d46c97d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20T=C3=B3th?= Date: Wed, 27 May 2026 13:34:01 +0000 Subject: [PATCH] Fix `kore_block_dump` --- bindings/c/lib.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bindings/c/lib.cpp b/bindings/c/lib.cpp index b69691151..1d3703ec4 100644 --- a/bindings/c/lib.cpp +++ b/bindings/c/lib.cpp @@ -266,14 +266,14 @@ block *kore_pattern_construct(kore_pattern const *pat) { } char *kore_block_dump(block *term) { - auto *hooked_str = print_configuration_to_string(term)->data; - auto len = std::strlen(hooked_str); + auto *orig_str = print_configuration_to_string(term); + auto orig_len = len(orig_str); - auto *new_str = static_cast(malloc(len + 1)); - std::strncpy(new_str, hooked_str, len); - new_str[len] = '\0'; + auto *c_str = static_cast(malloc(orig_len + 1)); + std::memcpy(c_str, orig_str->data, orig_len); + c_str[orig_len] = '\0'; - return new_str; + return c_str; } kore_pattern *kore_pattern_from_block(block *term) {