vsprintf: fix special yet useful case for vsprintf where n < 1.
reported by jaldhar.
This commit is contained in:
parent
6c2c2f3c34
commit
c4bb6abc2b
@ -21,8 +21,10 @@ vsnprintf(char *s, size_t n, const char *format, va_list arg)
|
|||||||
tmp_stream._count = n-1;
|
tmp_stream._count = n-1;
|
||||||
|
|
||||||
retval = _doprnt(format, arg, &tmp_stream);
|
retval = _doprnt(format, arg, &tmp_stream);
|
||||||
tmp_stream._count = 1;
|
if(n > 0) {
|
||||||
(void) putc('\0',&tmp_stream);
|
tmp_stream._count = 1;
|
||||||
|
(void) putc('\0',&tmp_stream);
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user