Blob Blame History Raw
From 34df9af8e15e331f45c3a453852d5a24486744ed Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 8 Jul 2020 11:17:18 -0700
Subject: [PATCH 6/8] Limit cdev name length comparsion to strlen()+1

In commit 270af678d4241306 cdev_name_equal() was updated
so that "eth1" and "eth10" did not match, but the limit
on the length of the compare was too large, as we know
the length of both strings. This is just a cleanup, and
should cause no functional change.
---
 lib/sysfs_class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c
index c696ff0..fcaa488 100644
--- a/lib/sysfs_class.c
+++ b/lib/sysfs_class.c
@@ -83,7 +83,7 @@ static int cdev_name_equal(void *a, void *b)
 	if (length_a != length_b)
 		return 0;
 
-	if (strncmp(str_a, str_b, SYSFS_NAME_LEN+1) == 0)
+	if (strncmp(str_a, str_b, length_a+1) == 0)
 		return 1;
 
 	return 0;
-- 
2.28.0