[rygel/rygel-0-30] core: Fix potential strncpy overflow



commit b820d314fb038f58c909d53084d6ddc66c20b0fb
Author: Jens Georg <mail jensge org>
Date:   Thu Apr 21 08:38:25 2016 +0200

    core: Fix potential strncpy overflow
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/librygel-core/rygel-energy-management-helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/librygel-core/rygel-energy-management-helper.c 
b/src/librygel-core/rygel-energy-management-helper.c
index e0a29b7..c5054f8 100644
--- a/src/librygel-core/rygel-energy-management-helper.c
+++ b/src/librygel-core/rygel-energy-management-helper.c
@@ -56,7 +56,7 @@ rygel_energy_management_get_mac_and_network_type (const char *iface,
         goto out;
     }
 
-    strncpy (ifr.ifr_name, iface, IFNAMSIZ);
+    strncpy (ifr.ifr_name, iface, IFNAMSIZ - 1);
     if (ioctl (fd, SIOCGIFHWADDR, &ifr) < 0) {
         g_warning (_("Failed to get MAC address for %s: %s"),
                    iface,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]