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

Re: [Xen-devel] [PATCH] console: avoid buffer overflow in guest_console_write()



Jan Beulich writes ("Re: [PATCH] console: avoid buffer overflow in 
guest_console_write()"):
> On 29.11.2019 11:22, Andrew Cooper wrote:
> > Is sizeof(array[0]) always 0, or is this just a GCC-ism ?  Godbolt
> > suggests is 0 on all compiler we support.
> > 
> > Either way, isn't the more common idiom + 0ul ?  Personally, I feel that
> > is clearer to follow.
> 
> I decided against + 0ul or alike because in principle size_t
> and unsigned long are different types. In particular 32-bit
> x86 gcc uses unsigned int for size_t, and hence min()'s
> type safety check would cause the build to fail there. The
> same risk obviously exists for any 32-bit arch (e.g. Arm32,
> but I haven't checked what type it actually uses).

I don't know what i wrong with
   (size_t)0
which is shorter, even !

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.