[PATCH libosinfo 2/5] db: Force anchored patterns when matching regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without forcing anchored patterns some matches may be completely wrong
as "(J_)?CENN?A_X64FREV" (volume-id for Windows 10) that could be taken
as a match for "HRM_CENNA_X64FREV" (volume-id of a Windows 8 ISO).

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 osinfo/osinfo_db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index fa14c6d..f4b3a8c 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -37,7 +37,7 @@ G_DEFINE_TYPE(OsinfoDb, osinfo_db, G_TYPE_OBJECT);
 #define match_regex(pattern, str)                                       \
     (((pattern) == NULL) ||                                             \
      (((str) != NULL) &&                                                \
-      g_regex_match_simple((pattern), (str), 0, 0)))
+      g_regex_match_simple((pattern), (str), 0, G_REGEX_MATCH_ANCHORED)))
 
 static gchar *get_raw_lang(const char *volume_id, const gchar *regex_str)
 {
-- 
2.17.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux