make_aligned_titles: pass the correct buffer length
The third parameter to wcstombs() is the length of the output buffer (first parameter) in bytes. Take the correct sizeof() here. This is not a problem in practice, but prevents _FORTIFY_SOURCE=3 from detecting a possible output buffer overflow (as the source buffer is bigger than the destination). Fixes #104. Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
This commit is contained in:
parent
95f148c222
commit
5e0496260b
1 changed files with 1 additions and 1 deletions
|
@ -140,7 +140,7 @@ static void make_aligned_titles(void)
|
|||
size_t padlen = maxcol - wcol[i];
|
||||
wmemset(wbuf[i] + wlen[i], L' ', padlen);
|
||||
wmemcpy(wbuf[i] + wlen[i] + padlen, title_suffix, ARRAYSIZE(title_suffix));
|
||||
wcstombs(titles[i], wbuf[i], sizeof(wbuf[i]));
|
||||
wcstombs(titles[i], wbuf[i], sizeof(titles[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue