代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/grub2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 6c0edcdc27568bb7ae9e5bd89ebc7b8c137f6bc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
Date: Wed, 3 May 2023 12:21:29 +0200
Subject: net/dns: Simplify error handling of recv_hook() function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit/grub-core/net/dns.c?id=6c0edcdc27568bb7ae9e5bd89ebc7b8c137f6bc0
Conflict:NA
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/net/dns.c | 50 +++++++++++++++------------------------------
1 file changed, 16 insertions(+), 34 deletions(-)
diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c
index e9edf5d..0aba533 100644
--- a/grub-core/net/dns.c
+++ b/grub-core/net/dns.c
@@ -262,42 +262,26 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
We may get multiple responses due to network condition, so check here
and quit early. */
if (*data->addresses)
- {
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
- }
+ goto out;
head = (struct dns_header *) nb->data;
ptr = (grub_uint8_t *) (head + 1);
if (ptr >= nb->tail)
- {
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
- }
-
+ goto out;
+
if (head->id != data->id)
- {
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
- }
+ goto out;
if (!(head->flags & FLAGS_RESPONSE) || (head->flags & FLAGS_OPCODE))
- {
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
- }
+ goto out;
if (head->ra_z_r_code & ERRCODE_MASK)
{
data->dns_err = 1;
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
+ goto out;
}
for (i = 0; i < grub_be_to_cpu16 (head->qdcount); i++)
{
if (ptr >= nb->tail)
- {
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
- }
+ goto out;
while (ptr < nb->tail && !((*ptr & 0xc0) || *ptr == 0))
ptr += *ptr + 1;
if (ptr < nb->tail && (*ptr & 0xc0))
@@ -310,8 +294,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
if (!*data->addresses)
{
grub_errno = GRUB_ERR_NONE;
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
+ goto out;
}
reparse_ptr = ptr;
reparse:
@@ -325,7 +308,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
{
if (!*data->naddresses)
grub_free (*data->addresses);
- return GRUB_ERR_NONE;
+ goto out;
}
ignored = !check_name (ptr, nb->data, nb->tail, data->name);
while (ptr < nb->tail && !((*ptr & 0xc0) || *ptr == 0))
@@ -337,8 +320,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
{
if (!*data->naddresses)
grub_free (*data->addresses);
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
+ goto out;
}
if (*ptr++ != 0)
ignored = 1;
@@ -358,8 +340,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
{
if (!*data->naddresses)
grub_free (*data->addresses);
- grub_netbuff_free (nb);
- return GRUB_ERR_NONE;
+ goto out;
}
if (!ignored)
{
@@ -400,15 +381,14 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
if (!data->name)
{
data->dns_err = 1;
- grub_errno = 0;
- return GRUB_ERR_NONE;
+ grub_errno = GRUB_ERR_NONE;
+ goto out;
}
grub_dprintf ("dns", "CNAME %s\n", data->name);
if (grub_strcmp (redirect_save, data->name) == 0)
{
data->dns_err = 1;
- grub_free (redirect_save);
- return GRUB_ERR_NONE;
+ goto out;
}
goto reparse;
}
@@ -440,6 +420,8 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)),
*data->naddresses
* sizeof (dns_cache[h].addresses[0]));
}
+
+ out:
grub_netbuff_free (nb);
grub_free (redirect_save);
return GRUB_ERR_NONE;
--
2.19.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。