summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2010-01-02 20:39:04 -0800
committerVinson Lee <[email protected]>2010-01-02 20:39:04 -0800
commitd2758f3b74838f4d4f1ae691fddca7dc9f4e8c0e (patch)
tree00e5049513cd15125e5869e785eabc80632e4fc7
parentbe6fb5c08350138ac85c1bf727553aaa9f4583e6 (diff)
st/xorg: Ensure null-terminated byte string.
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 68ddeae470f..0160b1aa59f 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -122,7 +122,8 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drm_mode.vrefresh = mode->VRefresh;
if (!mode->name)
xf86SetModeDefaultName(mode);
- strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN);
+ strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN - 1);
+ drm_mode.name[DRM_DISPLAY_MODE_LEN - 1] = '\0';
ret = drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
&drm_connector->connector_id, 1, &drm_mode);