VirtualBox

Changeset 35826 in vbox


Ignore:
Timestamp:
Feb 3, 2011 8:17:33 AM (14 years ago)
Author:
vboxsync
Message:

NAT/udp/socket: let's NAT send bodyless packets without annoying of memory management system.

File:
1 edited

Legend:

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

    r35346 r35826  
    870870    struct sockaddr_in host_addr;
    871871#endif
    872     caddr_t buf;
     872    caddr_t buf = 0;
    873873    int mlen;
    874874
     
    921921
    922922    /* Don't care what port we get */
     923    /*
     924     * > nmap -sV -T4 -O -A -v -PU3483 255.255.255.255
     925     * generates bodyless messages, annoying memmory management system.
     926     */
    923927    mlen = m_length(m, NULL);
    924     buf = RTMemAlloc(mlen);
    925     if (buf == NULL)
    926     {
    927         return -1;
    928     }
    929     m_copydata(m, 0, mlen, buf);
     928    if (mlen > 0)
     929    {
     930        buf = RTMemAlloc(mlen);
     931        if (buf == NULL)
     932        {
     933            return -1;
     934        }
     935        m_copydata(m, 0, mlen, buf);
     936    }
    930937    ret = sendto(so->s, buf, mlen, 0,
    931938                 (struct sockaddr *)&addr, sizeof (struct sockaddr));
    932     RTMemFree(buf);
     939    if (buf)
     940        RTMemFree(buf);
    933941    if (ret < 0)
    934942    {
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