Skip to contentSkip to conversation

drm: Ensure string is null terminated.

PATCH New Vinson Lee 1 participant 1 message Nov 10, 2011

Subsystems (2)
lore
Share & tools
lore

Vinson Lee

author
#0 lore raw

PATCH 1/1 drm: Ensure string is null terminated.

Fixes Coverity buffer not null terminated defect.

---
 drivers/gpu/drm/drm_crtc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_crtc.c +3 -1
index f3ef654..40a3a14 100644
@@ -2117,8 +2117,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;
Signature · 1 line
1.7.1