Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | grub-core/net/tftp.c: fix endianness problem. |
| 2 | |
| 3 | * grub-core/net/tftp.c (ack): Fix endianness problem. |
| 4 | (tftp_receive): Likewise. |
| 5 | Reported by: Michael Davidsaver. |
| 6 | |
| 7 | Upstream-Status: Backport |
| 8 | |
| 9 | diff --git a/ChangeLog b/ChangeLog |
| 10 | index 81bdae9..c2f42d5 100644 |
| 11 | --- a/ChangeLog |
| 12 | +++ b/ChangeLog |
| 13 | @@ -1,3 +1,9 @@ |
| 14 | +2012-07-02 Vladimir Serbinenko <phcoder@gmail.com> |
| 15 | + |
| 16 | + * grub-core/net/tftp.c (ack): Fix endianness problem. |
| 17 | + (tftp_receive): Likewise. |
| 18 | + Reported by: Michael Davidsaver. |
| 19 | + |
| 20 | 2012-06-27 Vladimir Serbinenko <phcoder@gmail.com> |
| 21 | |
| 22 | * configure.ac: Bump version to 2.00. |
| 23 | diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c |
| 24 | index 9c70efb..d0f39ea 100644 |
| 25 | --- a/grub-core/net/tftp.c |
| 26 | +++ b/grub-core/net/tftp.c |
| 27 | @@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block) |
| 28 | |
| 29 | tftph_ack = (struct tftphdr *) nb_ack.data; |
| 30 | tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK); |
| 31 | - tftph_ack->u.ack.block = block; |
| 32 | + tftph_ack->u.ack.block = grub_cpu_to_be16 (block); |
| 33 | |
| 34 | err = grub_net_send_udp_packet (data->sock, &nb_ack); |
| 35 | if (err) |
| 36 | @@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), |
| 37 | grub_priority_queue_pop (data->pq); |
| 38 | |
| 39 | if (file->device->net->packs.count < 50) |
| 40 | - err = ack (data, tftph->u.data.block); |
| 41 | + err = ack (data, data->block + 1); |
| 42 | else |
| 43 | { |
| 44 | file->device->net->stall = 1; |