Re: [PATCH v4] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc

From: Steven Rostedt
Date: Fri Feb 28 2025 - 10:03:54 EST


On Fri, 28 Feb 2025 14:09:48 +0000
Aditya Garg <gargaditya08@xxxxxxxx> wrote:

> > - *p++ = ' ';
> > - strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
> > - p += strlen(p);
> > + if (pixel_fmt) {
> > + *p++ = ' ';
> > + strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
>
> Do we need strscpy here?

Why? The size of what p points to has already been calculated to hold this:

char output[sizeof("0123 little-endian (0x01234567)")];
char *p = output;

Unless you changed something, it will not overflow.

-- Steve