2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 17:23:55 +08:00

drm: Ensure string is null terminated.

Fixes Coverity buffer not null terminated defect.

Signed-off-by: Vinson Lee <vlee@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Vinson Lee 2011-11-10 11:55:40 -08:00 committed by Dave Airlie
parent baa91d6400
commit 471dd2ef37

View File

@ -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;