VirtualBox

Ignore:
Timestamp:
Dec 16, 2008 11:24:50 AM (16 years ago)
Author:
vboxsync
Message:

NAT: sanity check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r15458 r15573  
    795795    struct icmp *icp;
    796796    int old_ip_len;
    797     int hlen, original_hlen;
     797    int hlen, original_hlen = 0;
    798798    struct mbuf *m;
    799799    struct icmp_msg *icm;
     
    805805
    806806    LogRel(("ICMP:received msg(t:%d, c:%d)\n", icp->icmp_type, icp->icmp_code));
    807     if (icp->icmp_type != ICMP_ECHOREPLY
    808         && icp->icmp_type != ICMP_TIMXCEED 
     807    if (   icp->icmp_type != ICMP_ECHOREPLY
     808        && icp->icmp_type != ICMP_TIMXCEED
    809809        && icp->icmp_type != ICMP_UNREACH)
    810810    {
     
    812812    }
    813813
    814     if (icp->icmp_type == ICMP_TIMXCEED
    815         || icp->icmp_type == ICMP_UNREACH )
     814    if (   icp->icmp_type == ICMP_TIMXCEED
     815        || icp->icmp_type == ICMP_UNREACH)
    816816        ip = &icp->icmp_ip;
    817817
     
    832832    proto = ip->ip_p;
    833833    /* Now ip is pointing on header we've sent from guest */
    834     if (icp->icmp_type == ICMP_TIMXCEED
    835         ||  icp->icmp_type == ICMP_UNREACH)
     834    if (   icp->icmp_type == ICMP_TIMXCEED
     835        || icp->icmp_type == ICMP_UNREACH)
    836836    {
    837837        old_ip_len = (ip->ip_hl << 2) + 64;
     838        if (old_ip_len > sizeof(ip_copy))
     839            old_ip_len = sizeof(ip_copy);
    838840        memcpy(ip_copy, ip, old_ip_len);
    839841    }
     
    852854
    853855    icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2));
    854     if (icp->icmp_type == ICMP_TIMXCEED
     856    if (   icp->icmp_type == ICMP_TIMXCEED
    855857        || icp->icmp_type == ICMP_UNREACH)
    856858    {
     
    866868    /* Don't call m_free here*/
    867869
    868     if (icp->icmp_type == ICMP_TIMXCEED
     870    if (   icp->icmp_type == ICMP_TIMXCEED
    869871        || icp->icmp_type == ICMP_UNREACH)
    870872    {
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