On Thu, May 2, 2019 at 12:02 PM Mark Wielaard <m...@klomp.org> wrote:
>
> Hi Jeffrey,
>
> On Tue, 2019-04-30 at 20:43 -0400, Jeffrey Walton wrote:
> > It looks like GCC has one squawk:
> >
> > vgdb.c: In function ‘standalone_send_commands’:
> > vgdb.c:1008:21: warning: ‘%02x’ directive writing between 2 and 8
> > bytes into a r
> > egion of size 3 [-Wformat-overflow=]
> >        sprintf(hex, "%02x", cksum);
> >                      ^~~~
> > vgdb.c:1008:20: note: directive argument in the range [0, 2147483647]
> >        sprintf(hex, "%02x", cksum);
> >                     ^~~~~~
>
> But cksum is an unsigned char, so value is be between [0, 255]. Which
> is max 2 hex chars.
>
> Could you retry with GCC8 or GCC9?
> And file a bug against GCC otherwise?

I thought it might be something like that.

I believe the char get promoted to an int for printf since it is
variadic. Maybe it would just be easier to workaround the finding by
making the buffer larger to accommodate an int.

Its not Valgrind's problem to be sure. Valgrind is just
working/playing nice with other tools.

Jeff

.


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to