VirtualBox

Changeset 83561 in vbox for trunk/src


Ignore:
Timestamp:
Apr 5, 2020 1:43:23 AM (5 years ago)
Author:
vboxsync
Message:

lwip: bugref:9708 - Cherry-pick from upstream coverity fixes and one
other minor fix that that commit depends upon.

Location:
trunk/src/VBox/Devices/Network/lwip-new/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/lwip-new/src/api/netdb.c

    r47886 r83561  
    315315  ai = (struct addrinfo *)memp_malloc(MEMP_NETDB);
    316316  if (ai == NULL) {
    317     goto memerr;
     317    return EAI_MEMORY;
    318318  }
    319319  memset(ai, 0, total_size);
     
    344344
    345345  return 0;
    346 memerr:
    347   if (ai != NULL) {
    348     memp_free(MEMP_NETDB, ai);
    349   }
    350   return EAI_MEMORY;
    351346}
    352347
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv4/igmp.c

    r47886 r83561  
    697697{
    698698  /* ensure the input value is > 0 */
     699#ifdef LWIP_RAND
    699700  if (max_time == 0) {
    700701    max_time = 1;
    701702  }
    702 #ifdef LWIP_RAND
    703703  /* ensure the random value is > 0 */
    704704  group->timer = (LWIP_RAND() % max_time);
     705  if (group->timer == 0) {
     706    group->timer = 1;
     707  }
     708#else /* LWIP_RAND */
     709  /* ATTENTION: use this only if absolutely necessary! */
     710  group->timer = max_time / 2;
     711  if (group->timer == 0) {
     712    group->timer = 1;
     713  }
    705714#endif /* LWIP_RAND */
    706715}
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/mld6.c

    r50189 r83561  
    500500#ifdef LWIP_RAND
    501501  /* Randomize maxresp. (if LWIP_RAND is supported) */
    502   maxresp = (LWIP_RAND() % (maxresp - 1)) + 1;
     502  maxresp = LWIP_RAND() % maxresp;
     503  if (maxresp == 0) {
     504    maxresp = 1;
     505  }
    503506#endif /* LWIP_RAND */
    504507
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/nd6.c

    r50189 r83561  
    505505        if (prefix_opt->flags & ND6_PREFIX_FLAG_ON_LINK) {
    506506          /* Add to on-link prefix list. */
     507          s8_t prefix;
    507508
    508509          /* Get a memory-aligned copy of the prefix. */
     
    510511
    511512          /* find cache entry for this prefix. */
    512           i = nd6_get_onlink_prefix(ip6_current_dest_addr(), inp);
    513           if (i < 0) {
     513          prefix = nd6_get_onlink_prefix(ip6_current_dest_addr(), inp);
     514          if (prefix < 0) {
    514515            /* Create a new cache entry. */
    515             i = nd6_new_onlink_prefix(ip6_current_dest_addr(), inp);
     516            prefix = nd6_new_onlink_prefix(ip6_current_dest_addr(), inp);
    516517          }
    517           if (i >= 0) {
    518             prefix_list[i].invalidation_timer = prefix_opt->valid_lifetime;
     518          if (prefix >= 0) {
     519            prefix_list[prefix].invalidation_timer = prefix_opt->valid_lifetime;
    519520
    520521#if LWIP_IPV6_AUTOCONFIG
     
    522523              /* Mark prefix as autonomous, so that address autoconfiguration can take place.
    523524               * Only OR flag, so that we don't over-write other flags (such as ADDRESS_DUPLICATE)*/
    524               prefix_list[i].flags |= ND6_PREFIX_AUTOCONFIG_AUTONOMOUS;
     525              prefix_list[prefix].flags |= ND6_PREFIX_AUTOCONFIG_AUTONOMOUS;
    525526            }
    526527#endif /* LWIP_IPV6_AUTOCONFIG */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette