From 0cf69874ee92184b515b3a0982cdadcfe2d4af29 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 12 Feb 2012 19:11:06 +0100 Subject: [PATCH] * grub-core/net/tftp.c (tftp_receive): Silently discard too short packets rather than raising an error. --- ChangeLog | 5 +++++ grub-core/net/tftp.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 512493b03..e927a455c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-02-12 Vladimir Serbinenko + + * grub-core/net/tftp.c (tftp_receive): Silently discard too short + packets rather than raising an error. + 2012-02-12 Vladimir Serbinenko * grub-core/loader/xnu.c (grub_xnu_writetree_toheap_real): Avoid set diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c index 1afe9b531..1992b8bfe 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -160,7 +160,10 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), grub_uint8_t *ptr; if (nb->tail - nb->data < (grub_ssize_t) sizeof (tftph->opcode)) - return grub_error (GRUB_ERR_OUT_OF_RANGE, "TFTP packet too small"); + { + grub_dprintf ("tftp", "TFTP packet too small\n"); + return GRUB_ERR_NONE; + } tftph = (struct tftphdr *) nb->data; switch (grub_be_to_cpu16 (tftph->opcode)) @@ -184,16 +187,17 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), grub_netbuff_free (nb); err = ack (data->sock, 0); grub_error_save (&data->save_err); - if (err) - return err; return GRUB_ERR_NONE; case TFTP_DATA: if (nb->tail - nb->data < (grub_ssize_t) (sizeof (tftph->opcode) + sizeof (tftph->u.data.block))) - return grub_error (GRUB_ERR_OUT_OF_RANGE, "TFTP packet too small"); + { + grub_dprintf ("tftp", "TFTP packet too small\n"); + return GRUB_ERR_NONE; + } err = ack (data->sock, tftph->u.data.block); if (err) - return err; + return err; err = grub_priority_queue_push (data->pq, &nb); if (err)