1 Star 0 Fork 16

phanddy/libosinfo

forked from src-openEuler/libosinfo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-db-Force-anchored-patterns-when-matching-regex.patch 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
syyhao 提交于 2019-12-31 23:48 . init repo
From e6168463f4fc659b9827b5c8694dc1c6d7d5239a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Fri, 7 Sep 2018 15:53:20 +0200
Subject: [PATCH] db: Force anchored patterns when matching regex
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
---
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)
{
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/phanddy/libosinfo.git
git@gitee.com:phanddy/libosinfo.git
phanddy
libosinfo
libosinfo
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385