Re: [PATCH] object-info: init request_info before reading arg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 4, 2023 at 12:36 AM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Jiang Xin <worldhello.net@xxxxxxxxx> writes:
>
> > From: Jiang Xin <zhiyou.jx@xxxxxxxxxxxxxxx>
> >
> > When retrieving object info via capability "object-info", we store the
> > command args into a requested_info variable, but forget to initialize
> > it. Initialize the variable before use to prevent unexpected output.
>
> Good eyes.  We read the request packets to decide if we want to flip
> the .size member of the structure, but the result would not make
> much sense if the structure starts with a random garbage in it.
>
> I wonder if we can tell our compilers (or runtime checker) to help
> catch a mistake like this.  Did you see our sanitizers complain, or
> something?

I accidentally came across this issue when I wanted to implement a new
similar capability. I'm curious why adding "-Wuninitialized" or
"-Wmaybe-uninitialized" to gcc fails to spot this case.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux