Example 4. ReactOS
project. Incorrect calculation of a string length ( vbe.c 57 )
static const PCHAR Nv11Board = "NV11 (GeForce2) Board";
static const PCHAR Nv11Chip = "Chip Rev B2";
static const PCHAR Nv11Vendor = "NVidia Corporation";
BOOLEAN
IsVesaBiosOk(...)
{
...
if (!(strncmp(Vendor, Nv11Vendor, sizeof(Nv11Vendor))) &&
!(strncmp(Product, Nv11Board, sizeof(Nv11Board))) &&
!(strncmp(Revision, Nv11Chip, sizeof(Nv11Chip))) &&
(OemRevision == 0x311))
...
}
Reason: The error here is this: the sizeof() operator, absolutely
inappropriate in this situation, is used to calculate string
lengths. The sizeof() operator actually calculates the pointer
size instead of the number of bytes in a string.
In this case Abragin said this is not a bug.
I said it is, but you left IRC too early. Rafal really confirmed by
testing.