aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/doc.c b/src/doc.c
index 4ac96c8..9bc9dc8 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2025 Robin Haberkorn
+ * Copyright (C) 2012-2026 Robin Haberkorn
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -205,7 +205,8 @@ teco_doc_get_string(teco_doc_t *ctx, gchar **str, gsize *outlen, guint *codepage
gsize len = teco_view_ssm(teco_qreg_view, SCI_GETLENGTH, 0, 0);
if (str) {
*str = g_malloc(len + 1);
- teco_view_ssm(teco_qreg_view, SCI_GETTEXT, len + 1, (sptr_t)*str);
+ /* null-terminates the string */
+ teco_view_ssm(teco_qreg_view, SCI_GETTEXT, len, (sptr_t)*str);
}
if (outlen)
*outlen = len;