patch 9.0.0527: long sign text may overflow buffer
Problem: Long sign text may overflow buffer.
Solution: Use a larger buffer. Prevent for overflow.
diff --git a/src/drawline.c b/src/drawline.c
index c423756..c77f888 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -124,7 +124,9 @@
int saved_c_final;
int saved_char_attr;
- char_u extra[21]; // "%ld " and 'fdc' must fit in here
+ char_u extra[NUMBUFLEN + MB_MAXBYTES];
+ // "%ld " and 'fdc' must fit in here, as well
+ // any text sign
#ifdef FEAT_DIFF
hlf_T diff_hlf; // type of diff highlighting
@@ -259,13 +261,13 @@
{
if (nrcol)
{
- int n, width = number_width(wp) - 2;
+ int width = number_width(wp) - 2;
+ int n;
for (n = 0; n < width; n++)
wlv->extra[n] = ' ';
- wlv->extra[n] = 0;
- STRCAT(wlv->extra, wlv->p_extra);
- STRCAT(wlv->extra, " ");
+ vim_snprintf((char *)wlv->extra + n,
+ sizeof(wlv->extra) - n, "%s ", wlv->p_extra);
wlv->p_extra = wlv->extra;
}
wlv->c_extra = NUL;