From 728cd8026c1be22713d0e62014faca0be8588775 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 2 Apr 2024 23:40:03 -0400 Subject: Bugfixes for long strings in docstring tests --- builtins/functions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtins') diff --git a/builtins/functions.c b/builtins/functions.c index aa410b74..acc0c758 100644 --- a/builtins/functions.c +++ b/builtins/functions.c @@ -148,8 +148,9 @@ public void $test(void *expr, const TypeInfo *type, CORD expected, const char *f size_t buf_len = sizeof(buf)-1; const char *expr_str = CORD_to_const_char_star(expr_cord); uint8_t *normalized_str = u8_normalize(UNINORM_NFD, (uint8_t*)expr_str, strlen(expr_str), buf, &buf_len); + normalized_str[buf_len] = 0; if (!normalized_str) errx(1, "Couldn't normalize unicode string!"); - CORD expr_normalized = CORD_from_char_star((char*)buf); + CORD expr_normalized = CORD_from_char_star((char*)normalized_str); if (normalized_str != buf) free(normalized_str); -- cgit v1.2.3