mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-17 22:19:19 -05:00
fixup! strbuf_vinsertf: provide the correct buffer size to vsnprintf
In preparation for a newer patch series. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
2
strbuf.c
2
strbuf.c
@@ -270,7 +270,7 @@ void strbuf_vinsertf(struct strbuf *sb, size_t pos, const char *fmt, va_list ap)
|
||||
memmove(sb->buf + pos + len, sb->buf + pos, sb->len - pos);
|
||||
/* vsnprintf() will append a NUL, overwriting one of our characters */
|
||||
save = sb->buf[pos + len];
|
||||
len2 = vsnprintf(sb->buf + pos, len + 1, fmt, ap);
|
||||
len2 = vsnprintf(sb->buf + pos, sb->alloc - sb->len, fmt, ap);
|
||||
sb->buf[pos + len] = save;
|
||||
if (len2 != len)
|
||||
BUG("your vsnprintf is broken (returns inconsistent lengths)");
|
||||
|
||||
Reference in New Issue
Block a user