Skip to content

Commit

Permalink
drm: Ensure string is null terminated.
Browse files Browse the repository at this point in the history
Fixes Coverity buffer not null terminated defect.

Signed-off-by: Vinson Lee <vlee@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Vinson Lee authored and Dave Airlie committed Nov 11, 2011
1 parent baa91d6 commit 471dd2e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 471dd2e

Please sign in to comment.