File sysfsutils-Limit-cdev-name-length-comparsion-to-strlen-1.patch of Package sysfsutils.15841
From ae354aa6f926d70fb8aa5d2c8a9fc534c386762a Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 8 Jul 2020 11:17:18 -0700
Subject: [PATCH 3/3] 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 c696ff04b620..fcaa488b9943 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.26.2