代码拉取完成,页面将自动刷新
From 46843e71656264d98ceda79985e5d341a8d58aa7 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Thu, 22 Dec 2016 17:52:14 -0500
Subject: [PATCH 37/55] Fix findTemplate index logic (#1285601)
The fallback case where findTemplate has to look for the first entry
contained a logic flaw that could return an incorrect index. This
discovered index should be reduced by one for each boot entry that will
be skipped in the final output. The flaw occurred because the index
variable was used for the loop upper bound at the same time as it was
being decremented within the actual loop body. The loop would thus fail
to examine a number of boot entries equal to the total number of
iterations the loop performed.
Related: rhbz#1285601
---
grubby.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/grubby.c b/grubby.c
index fcca6364887..692c351ccb6 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2436,8 +2436,11 @@ struct singleEntry *findTemplate(struct grubConfig *cfg, const char *prefix,
index = 0;
while ((entry = findEntryByIndex(cfg, index))) {
if (suitableImage(entry, prefix, skipRemoved, flags)) {
- int j;
- for (j = 0; j < index; j++) {
+ int j, unmodifiedIndex;
+
+ unmodifiedIndex = index;
+
+ for (j = 0; j < unmodifiedIndex; j++) {
entry2 = findEntryByIndex(cfg, j);
if (entry2->skip)
index--;
--
2.17.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。