mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
An update to as-yet unused new feature of snprintf, which was added to bring
our sprintf()-alike in sync with our fprintf()-alike features. strings/my_vsnprintf.c: Advance the destination pointer properly. Also, pay attention to the "n" in snprintf() -- never write too much.
This commit is contained in:
@ -99,7 +99,11 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
|
|||||||
else if (*fmt == 'b') /* Buffer parameter */
|
else if (*fmt == 'b') /* Buffer parameter */
|
||||||
{
|
{
|
||||||
char *par = va_arg(ap, char *);
|
char *par = va_arg(ap, char *);
|
||||||
to=memmove(to, par, abs(width));
|
DBUG_ASSERT(to <= end);
|
||||||
|
if (to + abs(width) + 1 > end)
|
||||||
|
width= end - to - 1; /* sign doesn't matter */
|
||||||
|
memmove(to, par, abs(width));
|
||||||
|
to+= width;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (*fmt == 'd' || *fmt == 'u'|| *fmt== 'x') /* Integer parameter */
|
else if (*fmt == 'd' || *fmt == 'u'|| *fmt== 'x') /* Integer parameter */
|
||||||
|
Reference in New Issue
Block a user