Fix crash issue 10/182210/1 accepted/tizen_5.0_unified accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix accepted/tizen_6.0_unified_hotfix tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix tizen_6.0_hotfix accepted/tizen/5.0/unified/20181102.024411 accepted/tizen/5.5/unified/20191031.005105 accepted/tizen/5.5/unified/mobile/hotfix/20201027.062024 accepted/tizen/5.5/unified/wearable/hotfix/20201027.102254 accepted/tizen/6.0/unified/20201030.104344 accepted/tizen/6.0/unified/hotfix/20201102.235526 accepted/tizen/unified/20180622.122621 submit/tizen/20180621.080823 submit/tizen_5.0/20181101.000006 submit/tizen_5.5/20191031.000006 submit/tizen_5.5_mobile_hotfix/20201026.185106 submit/tizen_5.5_wearable_hotfix/20201026.184306 submit/tizen_6.0/20201029.205501 submit/tizen_6.0_hotfix/20201102.192901 submit/tizen_6.0_hotfix/20201103.115101 tizen_5.5.m2_release tizen_6.0.m2_release
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 15 Jun 2018 05:33:36 +0000 (14:33 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 21 Jun 2018 07:56:50 +0000 (16:56 +0900)
SIGBUS crash has occured when ipv6 address is copied.

Change-Id: Ie58721f2f8aa909c61d97c7640f0897bfdb5383e

src/lease.c
src/rfc3315.c

index 5c33df7..64f6647 100644 (file)
@@ -687,16 +687,21 @@ struct dhcp_lease *lease6_find_by_client(struct dhcp_lease *first, int lease_typ
 struct dhcp_lease *lease6_find_by_addr(struct in6_addr *net, int prefix, u64 addr)
 {
   struct dhcp_lease *lease;
-    
+
+  my_syslog(MS_DHCP | LOG_INFO, "lease6_find_by_addr(): +");
+
   for (lease = leases; lease; lease = lease->next)
     {
       if (!(lease->flags & (LEASE_TA | LEASE_NA)))
        continue;
       
       if (is_same_net6(&lease->addr6, net, prefix) &&
-         (prefix == 128 || addr6part(&lease->addr6) == addr))
+         (prefix == 128 || addr6part(&lease->addr6) == addr)) {
+    my_syslog(MS_DHCP | LOG_INFO, "lease6_find_by_addr(): -");
        return lease;
+         }
     }
+  my_syslog(MS_DHCP | LOG_INFO, "lease6_find_by_addr(): -");
   
   return NULL;
 } 
@@ -750,6 +755,9 @@ struct in_addr lease_find_max_addr(struct dhcp_context *context)
 static struct dhcp_lease *lease_allocate(void)
 {
   struct dhcp_lease *lease;
+
+  my_syslog(MS_DHCP | LOG_INFO, "lease_allocate(): +");
+
   if (!leases_left || !(lease = whine_malloc(sizeof(struct dhcp_lease))))
     return NULL;
 
@@ -766,6 +774,8 @@ static struct dhcp_lease *lease_allocate(void)
   file_dirty = 1;
   leases_left--;
 
+  my_syslog(MS_DHCP | LOG_INFO, "lease_allocate(): -");
+
   return lease;
 }
 
@@ -781,15 +791,18 @@ struct dhcp_lease *lease4_allocate(struct in_addr addr)
 #ifdef HAVE_DHCP6
 struct dhcp_lease *lease6_allocate(struct in6_addr *addrp, int lease_type)
 {
+    my_syslog(MS_DHCP | LOG_INFO, "lease6_allocate(): +");
+
   struct dhcp_lease *lease = lease_allocate();
 
   if (lease)
     {
-      lease->addr6 = *addrp;
+      memcpy(&lease->addr6, addrp, sizeof(struct in6_addr));
       lease->flags |= lease_type;
       lease->iaid = 0;
     }
 
+  my_syslog(MS_DHCP | LOG_INFO, "lease6_allocate(): -");
   return lease;
 }
 #endif
index 3a2ed75..d416a90 100644 (file)
@@ -1814,6 +1814,7 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
 #ifdef HAVE_SCRIPT
   struct dhcp_netid *tagif = run_tag_if(state->tags);
 #endif
+  my_syslog(MS_DHCP | LOG_INFO, "update_leases(): +");
 
   (void)context;
 
@@ -1902,6 +1903,7 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
 #endif
 
     }
+  my_syslog(MS_DHCP | LOG_INFO, "update_leases(): -");
 }