dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0006-grub-core-net-tftp.c-ack-Fix-endianness-problem.patch

f96e0b
From 8ec34c46a3cc4cacce65e3a2a671e08548c6a95e Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Mon, 2 Jul 2012 11:22:50 +0200
f96e0b
Subject: [PATCH 006/482] 	* grub-core/net/tftp.c (ack): Fix endianness
f96e0b
 problem. 	(tftp_receive): Likewise. 	Reported by: Michael
f96e0b
 Davidsaver.
f96e0b
f96e0b
---
f96e0b
 ChangeLog            | 6 ++++++
f96e0b
 grub-core/net/tftp.c | 4 ++--
f96e0b
 2 files changed, 8 insertions(+), 2 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index aaeeb05..12de11f 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,5 +1,11 @@
f96e0b
 2012-07-02  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
+	* grub-core/net/tftp.c (ack): Fix endianness problem.
f96e0b
+	(tftp_receive): Likewise.
f96e0b
+	Reported by: Michael Davidsaver.
f96e0b
+
f96e0b
+2012-07-02  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
 	* gentpl.py: Make mans depend on grub-mkconfig_lib.
f96e0b
 
f96e0b
 2012-07-02  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
f96e0b
index 9c70efb..d0f39ea 100644
f96e0b
--- a/grub-core/net/tftp.c
f96e0b
+++ b/grub-core/net/tftp.c
f96e0b
@@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block)
f96e0b
 
f96e0b
   tftph_ack = (struct tftphdr *) nb_ack.data;
f96e0b
   tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
f96e0b
-  tftph_ack->u.ack.block = block;
f96e0b
+  tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
f96e0b
 
f96e0b
   err = grub_net_send_udp_packet (data->sock, &nb_ack);
f96e0b
   if (err)
f96e0b
@@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
f96e0b
 	    grub_priority_queue_pop (data->pq);
f96e0b
 
f96e0b
 	    if (file->device->net->packs.count < 50)
f96e0b
-	      err = ack (data, tftph->u.data.block);
f96e0b
+	      err = ack (data, data->block + 1);
f96e0b
 	    else
f96e0b
 	      {
f96e0b
 		file->device->net->stall = 1;
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b