]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/net/tftp.c (tftp_receive): Silently discard too short
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 12 Feb 2012 18:11:06 +0000 (19:11 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 12 Feb 2012 18:11:06 +0000 (19:11 +0100)
packets rather than raising an error.

ChangeLog
grub-core/net/tftp.c

index 512493b03ba42d314c4e8d30245382b9ed3e9747..e927a455c840de0701840e4f99beb1f10c5f3f2a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-12  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/net/tftp.c (tftp_receive): Silently discard too short
+       packets rather than raising an error.
+
 2012-02-12  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/loader/xnu.c (grub_xnu_writetree_toheap_real): Avoid set
index 1afe9b531514aaf90151b7eb7b6b1ca39bf5ac8f..1992b8bfe84ab38e7b6464f2beb753f7aa054cbc 100644 (file)
@@ -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)