MakeAtom needs length without trailing NUL. sizeof("string") includes NUL.
I made a mistake in some new code using MakeAtom, passing the size of the string instead of the length of the string. Figuring there might be other such mistakes, I reviewed the server code and found four bugs of the same form.
This commit is contained in:
parent
393171034c
commit
ac979c1651
|
@ -740,7 +740,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
}
|
}
|
||||||
*VT = xf86Info.vtno;
|
*VT = xf86Info.vtno;
|
||||||
|
|
||||||
VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME), TRUE);
|
VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
|
||||||
|
|
||||||
for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) {
|
for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) {
|
||||||
ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
|
ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
|
||||||
|
|
|
@ -87,7 +87,7 @@ addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
|
||||||
if ((EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL)
|
if ((EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDID1Atom = MakeAtom(EDID1_ATOM_NAME, sizeof(EDID1_ATOM_NAME), TRUE);
|
EDID1Atom = MakeAtom(EDID1_ATOM_NAME, sizeof(EDID1_ATOM_NAME) - 1, TRUE);
|
||||||
memcpy(EDID1rawdata, DDC->rawData, 128);
|
memcpy(EDID1rawdata, DDC->rawData, 128);
|
||||||
xf86RegisterRootWindowProperty(scrnIndex, EDID1Atom, XA_INTEGER, 8,
|
xf86RegisterRootWindowProperty(scrnIndex, EDID1Atom, XA_INTEGER, 8,
|
||||||
128, (unsigned char *)EDID1rawdata);
|
128, (unsigned char *)EDID1rawdata);
|
||||||
|
@ -98,7 +98,7 @@ addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memcpy(EDID2rawdata, DDC->rawData, 256);
|
memcpy(EDID2rawdata, DDC->rawData, 256);
|
||||||
EDID2Atom = MakeAtom(EDID2_ATOM_NAME, sizeof(EDID2_ATOM_NAME), TRUE);
|
EDID2Atom = MakeAtom(EDID2_ATOM_NAME, sizeof(EDID2_ATOM_NAME) - 1, TRUE);
|
||||||
xf86RegisterRootWindowProperty(scrnIndex, EDID2Atom, XA_INTEGER, 8,
|
xf86RegisterRootWindowProperty(scrnIndex, EDID2Atom, XA_INTEGER, 8,
|
||||||
256, (unsigned char *)EDID2rawdata);
|
256, (unsigned char *)EDID2rawdata);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2031,7 +2031,7 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
|
||||||
static void
|
static void
|
||||||
xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
|
xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
|
||||||
{
|
{
|
||||||
Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME), TRUE);
|
Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME) - 1, TRUE);
|
||||||
|
|
||||||
/* This may get called before the RandR resources have been created */
|
/* This may get called before the RandR resources have been created */
|
||||||
if (output->randr_output == NULL)
|
if (output->randr_output == NULL)
|
||||||
|
|
Loading…
Reference in New Issue