Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-efivar: Commit

external/efivar


Commit MetaInfo

Révision836461e480e2249de134efeaef79588cab045d5c (tree)
l'heure2019-03-06 03:14:47
AuteurJavier Martinez Canillas <javierm@redh...>
CommiterPeter Jones

Message de Log

dp-message: fix efidp_ipv4_addr fields assignment

The efidp_ipv4_addr structure has some 4-byte array fields to store IPv4
addresses and network mask. But the efidp_make_ipv4() function wrongly
casts these as a char * before dereferencing them to store a value.

Instead, cast it to a uint32_t * so the 32-bit value is correctly stored.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

Change Summary

Modification

--- a/src/dp-message.c
+++ b/src/dp-message.c
@@ -678,16 +678,16 @@ efidp_make_ipv4(uint8_t *buf, ssize_t size, uint32_t local, uint32_t remote,
678678 EFIDP_MSG_IPv4, sizeof (*ipv4));
679679 ssize_t req = sizeof (*ipv4);
680680 if (size && sz == req) {
681- *((char *)ipv4->local_ipv4_addr) = htonl(local);
682- *((char *)ipv4->remote_ipv4_addr) = htonl(remote);
681+ *((uint32_t *)ipv4->local_ipv4_addr) = htonl(local);
682+ *((uint32_t *)ipv4->remote_ipv4_addr) = htonl(remote);
683683 ipv4->local_port = htons(local_port);
684684 ipv4->remote_port = htons(remote_port);
685685 ipv4->protocol = htons(protocol);
686686 ipv4->static_ip_addr = 0;
687687 if (is_static)
688688 ipv4->static_ip_addr = 1;
689- *((char *)ipv4->gateway) = htonl(gateway);
690- *((char *)ipv4->netmask) = htonl(netmask);
689+ *((uint32_t *)ipv4->gateway) = htonl(gateway);
690+ *((uint32_t *)ipv4->netmask) = htonl(netmask);
691691 }
692692
693693 if (sz < 0)
Afficher sur ancien navigateur de dépôt.