summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 77c28d4..fe35e2f 100644
--- a/utf8.c
+++ b/utf8.c
@@ -444,6 +444,9 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
dst += n;
}
+ if (src >= end)
+ break;
+
old = src;
n = utf8_width((const char**)&src, NULL);
if (!src) /* broken utf-8, do nothing */