xserver: Branch 'master'
Keith Packard
keithp at kemper.freedesktop.org
Sat Jul 14 12:16:19 PDT 2007
hw/xfree86/common/xf86Init.c | 2 +-
hw/xfree86/ddc/ddcProperty.c | 4 ++--
hw/xfree86/modes/xf86Crtc.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
New commits:
diff-tree ac979c165128704116cd40086320b6edc79018e2 (from 393171034c15d8a1b82232b8f9455a358035e932)
Author: Keith Packard <keithp at neko.keithp.com>
Date: Sat Jul 14 12:13:17 2007 -0700
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.
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index d098e13..c0775d1 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -740,7 +740,7 @@ InitOutput(ScreenInfo *pScreenInfo, int
}
*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++) {
ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 6ff0726..67351d3 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -87,7 +87,7 @@ addRootWindowProperties(ScrnInfoPtr pScr
if ((EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL)
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);
xf86RegisterRootWindowProperty(scrnIndex, EDID1Atom, XA_INTEGER, 8,
128, (unsigned char *)EDID1rawdata);
@@ -98,7 +98,7 @@ addRootWindowProperties(ScrnInfoPtr pScr
return;
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,
256, (unsigned char *)EDID2rawdata);
}
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 722b62b..ecdf620 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2031,7 +2031,7 @@ xf86DisableUnusedFunctions(ScrnInfoPtr p
static void
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 */
if (output->randr_output == NULL)
More information about the xorg-commit
mailing list