aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-02 23:40:03 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-02 23:40:03 -0400
commit728cd8026c1be22713d0e62014faca0be8588775 (patch)
tree9a76a8d0de43cad3f9cbccbafdfa27d8df5f288f
parentfae2b2caa0ec311821a7a7ef1f98500cfd25bb9e (diff)
Bugfixes for long strings in docstring tests
-rw-r--r--builtins/functions.c3
1 files changed, 2 insertions, 1 deletions
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);