VirtualBox

Changeset 21076 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 30, 2009 3:19:04 PM (16 years ago)
Author:
vboxsync
Message:

Solaris/VBoxNetFlt: some paranoia on message sizes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r19884 r21076  
    28632863    }
    28642864
     2865    LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk returns %d.\n", fIsOurPacket));
    28652866    RTSemFastMutexRelease(pThis->u.s.hFastMtx);
    28662867    return fIsOurPacket;
     
    28942895     * Don't loopback packets we transmit to the wire.
    28952896     */
    2896     /** @todo maybe we need not check for loopback for INTNETTRUNKDIR_HOST case? */
    28972897    if (vboxNetFltSolarisIsOurMBlk(pThis, pPromiscStream, pMsg))
    28982898    {
    28992899        LogFlow((DEVICE_NAME ":Avoiding packet loopback.\n"));
    29002900        return VINF_SUCCESS;
     2901    }
     2902
     2903    /*
     2904     * Paranoia...
     2905     */
     2906    if (MBLKL(pMsg) < sizeof(RTNETETHERHDR))
     2907    {
     2908        size_t cbMsg = msgdsize(pMsg);
     2909        if (cbMsg < sizeof(RTNETETHERHDR))
     2910            return VINF_SUCCESS;
     2911
     2912        mblk_t *pFullMsg = allocb(cbMsg, BPRI_MED);
     2913        if (RT_LIKELY(pFullMsg))
     2914        {
     2915            mblk_t *pCur = pMsg;
     2916            while (pCur)
     2917            {
     2918                size_t cbBlock = MBLKL(pCur);
     2919                if (cbBlock > 0)
     2920                {
     2921                    bcopy(pCur->b_rptr, pFullMsg->b_wptr, cbBlock);
     2922                    pFullMsg->b_wptr += cbBlock;
     2923                }
     2924                pCur = pCur->b_cont;
     2925            }
     2926
     2927            freemsg(pMsg);
     2928            pMsg = pFullMsg;
     2929        }
     2930        else
     2931            return VERR_NO_MEMORY;
    29012932    }
    29022933
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