* grub-core/net/drivers/emu/emunet.c (get_card_packet): Allocate the

reserved bytes.
	* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_recv): Likewise.
	* grub-core/net/drivers/ieee1275/ofnet.c (get_card_packet): Likewise.
	Handle malloc error correctly.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-21 22:05:41 +02:00
parent cde393c9a3
commit 531e2241a6
4 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2012-06-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/net/drivers/emu/emunet.c (get_card_packet): Allocate the
reserved bytes.
* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_recv): Likewise.
* grub-core/net/drivers/ieee1275/ofnet.c (get_card_packet): Likewise.
Handle malloc error correctly.
2012-06-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/execute.c (grub_script_arglist_to_argv): Escape

View File

@ -52,7 +52,7 @@ get_card_packet (struct grub_net_card *dev __attribute__ ((unused)))
ssize_t actual;
struct grub_net_buff *nb;
nb = grub_netbuff_alloc (1536);
nb = grub_netbuff_alloc (1536 + 2);
if (!nb)
return NULL;

View File

@ -213,7 +213,7 @@ grub_pxe_recv (struct grub_net_card *dev __attribute__ ((unused)))
grub_pxe_call (GRUB_PXENV_UNDI_ISR, isr, pxe_rm_entry);
}
buf = grub_netbuff_alloc (isr->frame_len);
buf = grub_netbuff_alloc (isr->frame_len + 2);
if (!buf)
return NULL;
/* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible

View File

@ -95,15 +95,16 @@ get_card_packet (struct grub_net_card *dev)
grub_uint64_t start_time;
struct grub_net_buff *nb;
nb = grub_netbuff_alloc (dev->mtu + 64);
/* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
by 4. So that IP header is aligned on 4 bytes. */
grub_netbuff_reserve (nb, 2);
nb = grub_netbuff_alloc (dev->mtu + 64 + 2);
if (!nb)
{
grub_netbuff_free (nb);
return NULL;
}
/* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
by 4. So that IP header is aligned on 4 bytes. */
grub_netbuff_reserve (nb, 2);
start_time = grub_get_time_ms ();
do
rc = grub_ieee1275_read (data->handle, nb->data, dev->mtu + 64, &actual);