[systemd-commits] src/network

Tom Gundersen tomegun at kemper.freedesktop.org
Thu Nov 21 11:43:51 PST 2013


 src/network/networkd-link.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 602cc437e8b4a3ab760b5a23fa4f3112134d9c36
Author: Tom Gundersen <teg at jklm.no>
Date:   Thu Nov 21 20:47:34 2013 +0100

    networkd: avoid segfault

diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index d41fe80..c034722 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -29,6 +29,7 @@
 int link_new(Manager *manager, struct udev_device *device, Link **ret) {
         _cleanup_link_free_ Link *link = NULL;
         const char *mac;
+        struct ether_addr *mac_addr;
         int r;
 
         assert(device);
@@ -46,7 +47,12 @@ int link_new(Manager *manager, struct udev_device *device, Link **ret) {
         if (!mac)
                 return -EINVAL;
 
-        memcpy(&link->mac.ether_addr_octet[0], ether_aton(mac), ETH_ALEN);
+        mac_addr = ether_aton(mac);
+        if (!mac_addr)
+                return -EINVAL;
+
+        memcpy(&link->mac, mac_addr, sizeof(struct ether_addr));
+
         link->manager = manager;
         link->state = _LINK_STATE_INVALID;
 



More information about the systemd-commits mailing list