[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen/lib: Fix strcmp() and strncmp()
On 28/07/2021 11:42, Ian Jackson wrote:
[CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe. Jane Malalane writes ("[PATCH] xen/lib: Fix strcmp() and strncmp()"):The C standard requires that each character be compared as unsigned char. Xen's current behaviour compares as signed char, which changes the answer when chars with a value greater than 0x7f are used. Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Signed-off-by: Jane Malalane <jane.malalane@xxxxxxxxxx>Thanks for this. What are the practical effects of this bug ? AFAICT in the hypervisor code all the call sites simply test for zero/nonzero. Of course we should fix this because- if ((__res = *cs - *ct++) != 0 || !*cs++)this substraction is UB if it overflows. So in theory the compiler could miscompile it - although in practice I can't see how the assumption that this doesn't overflow would "help" the compiler. Ian.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |