Re: [RFC][PATCH] vsprintf: Do not have bprintf dereference pointers

From: Steven Rostedt
Date: Thu Dec 28 2017 - 20:03:35 EST


On Thu, 28 Dec 2017 18:50:26 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> + default:
> + if (!isalnum(*fmt)) {
> + process = true;
> + break;
> + }
> + /* Pointer dereference was already processed */
> + if (str < end) {
> + len = copy = strlen(args);
> + if (copy > end - str)
> + copy = end - str;
> + memcpy(str, args, copy);
> + str += copy;

Actually, that should have been: str += len; as str will be used to
return the amount that would be processed, even if the size wasn't long
enough.

V2 coming up.

-- Steve

> + args += len;
> + }
> + }