提交 471dd2ef 编写于 作者: V Vinson Lee 提交者: Dave Airlie

drm: Ensure string is null terminated.

Fixes Coverity buffer not null terminated defect.
Signed-off-by: NVinson Lee <vlee@vmware.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 baa91d64
...@@ -2118,8 +2118,10 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, ...@@ -2118,8 +2118,10 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
property->num_values = num_values; property->num_values = num_values;
INIT_LIST_HEAD(&property->enum_blob_list); INIT_LIST_HEAD(&property->enum_blob_list);
if (name) if (name) {
strncpy(property->name, name, DRM_PROP_NAME_LEN); 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); list_add_tail(&property->head, &dev->mode_config.property_list);
return property; return property;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册