Ignore:
Timestamp:
Mar 3, 2003, 5:34:39 PM (22 years ago)
Author:
sandervl
Message:

Removed wrong checks for invalid address parameters in sendto & recvfrom

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wsock32/wsock32.cpp

    r9844 r9887  
    1 /* $Id: wsock32.cpp,v 1.51 2003-02-24 11:14:56 sandervl Exp $ */
     1/* $Id: wsock32.cpp,v 1.52 2003-03-03 16:34:39 sandervl Exp $ */
    22
    33/*
     
    724724        return SOCKET_ERROR;
    725725   }
    726    else
    727    if(fromlen == NULL || *fromlen < (int)sizeof(struct sockaddr_in)) {
    728         WSASetLastError(WSAEFAULT);
    729         return SOCKET_ERROR;
    730    }
    731    dprintf(("recvfrom to %s", inet_ntoa(((sockaddr_in*)from)->sin_addr)));
    732 
     726   //NOTE: do not check from & fromlen; they are allowed to be NULL/0
     727
     728   if(from) {
     729       dprintf(("recvfrom to %s", inet_ntoa(((sockaddr_in*)from)->sin_addr)));
     730   }
    733731   ret = recvfrom(s, buf, len, flags, from, fromlen);
    734732
     
    822820        return SOCKET_ERROR;
    823821   }
    824    else
    825    if(tolen < (int)sizeof(struct sockaddr_in)) {
    826         WSASetLastError(WSAEFAULT);
    827         return SOCKET_ERROR;
    828    }
     822   //NOTE: do not check to & tolen; they are allowed to be NULL/0
     823
    829824   // check if the socket is a raw socket and has the IP_HDRINCL switch
    830825   // if this is the case, we overwrite the IP header length field with
     
    837832       *(u_short *)&buf[2] = len;
    838833   }
    839    dprintf(("sending to %s", inet_ntoa(((sockaddr_in*)to)->sin_addr)));
     834   if(to) {
     835       dprintf(("sending to %s", inet_ntoa(((sockaddr_in*)to)->sin_addr)));
     836   }
    840837#ifdef DUMP_PACKETS
    841838   dprintf2(("Packet length %d", len));
Note: See TracChangeset for help on using the changeset viewer.