st/xorg: Ensure null-terminated byte string.
authorVinson Lee <vlee@vmware.com>
Sun, 3 Jan 2010 04:39:04 +0000 (20:39 -0800)
committerVinson Lee <vlee@vmware.com>
Sun, 3 Jan 2010 04:39:04 +0000 (20:39 -0800)
src/gallium/state_trackers/xorg/xorg_crtc.c

index 68ddeae470fca0e4a7fd9e896d4f38242065bfef..0160b1aa59f6c22b9144d990ba0e3fc90e3e3e6d 100644 (file)
@@ -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);