Fix tftp endianness problem.

This commit is contained in:
Colin Watson 2012-09-26 13:47:00 +01:00
parent 1c65b2d2f1
commit 227bfa7488
4 changed files with 33 additions and 2 deletions

1
debian/changelog vendored
View File

@ -2,6 +2,7 @@ grub2 (2.00-7) UNRELEASED; urgency=low
* Backport from upstream:
- Fix stderr leakage from grub-probe in is_path_readable_by_grub.
- Fix tftp endianness problem.
-- Colin Watson <cjwatson@debian.org> Wed, 26 Sep 2012 13:16:52 +0100

View File

@ -24,3 +24,4 @@ mkconfig_ubuntu_recovery.patch
msdos_embed_off_by_one.patch
emu_freebsd.patch
mkconfig_stderr_handling.patch
tftp_endianness.patch

29
debian/patches/tftp_endianness.patch vendored Normal file
View File

@ -0,0 +1,29 @@
Description: Fix tftp endianness problem
Author: Vladimir Serbinenko <phcoder@gmail.com>
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4548
Forwarded: not-needed
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4548
Last-Update: 2012-09-26
Index: b/grub-core/net/tftp.c
===================================================================
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -143,7 +143,7 @@
tftph_ack = (struct tftphdr *) nb_ack.data;
tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
- tftph_ack->u.ack.block = block;
+ tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
err = grub_net_send_udp_packet (data->sock, &nb_ack);
if (err)
@@ -225,7 +225,7 @@
grub_priority_queue_pop (data->pq);
if (file->device->net->packs.count < 50)
- err = ack (data, tftph->u.data.block);
+ err = ack (data, data->block + 1);
else
{
file->device->net->stall = 1;

View File

@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block)
tftph_ack = (struct tftphdr *) nb_ack.data;
tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
tftph_ack->u.ack.block = block;
tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
err = grub_net_send_udp_packet (data->sock, &nb_ack);
if (err)
@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
grub_priority_queue_pop (data->pq);
if (file->device->net->packs.count < 50)
err = ack (data, tftph->u.data.block);
err = ack (data, data->block + 1);
else
{
file->device->net->stall = 1;