From: Vinson Lee Date: Sun, 3 Jan 2010 04:39:04 +0000 (-0800) Subject: st/xorg: Ensure null-terminated byte string. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d2758f3b74838f4d4f1ae691fddca7dc9f4e8c0e;p=mesa.git st/xorg: Ensure null-terminated byte string. --- 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);