drm: Ensure string is null terminated.
authorVinson Lee <vlee@vmware.com>
Thu, 10 Nov 2011 19:55:40 +0000 (11:55 -0800)
committerDave Airlie <airlied@redhat.com>
Fri, 11 Nov 2011 10:59:15 +0000 (10:59 +0000)
Fixes Coverity buffer not null terminated defect.

Signed-off-by: Vinson Lee <vlee@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c

index 9a2e2a14b3bb2e2c1631ae40341d886e1148bef9..405c63b9d539a74826b0ecfdb6d4000f5a43b2f5 100644 (file)
@@ -2118,8 +2118,10 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
        property->num_values = num_values;
        INIT_LIST_HEAD(&property->enum_blob_list);
 
-       if (name)
+       if (name) {
                strncpy(property->name, name, DRM_PROP_NAME_LEN);
+               property->name[DRM_PROP_NAME_LEN-1] = '\0';
+       }
 
        list_add_tail(&property->head, &dev->mode_config.property_list);
        return property;