From d2758f3b74838f4d4f1ae691fddca7dc9f4e8c0e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 2 Jan 2010 20:39:04 -0800 Subject: st/xorg: Ensure null-terminated byte string. --- src/gallium/state_trackers/xorg/xorg_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3