Bug 338179: Ineffective NULL checks in nsSocket::Send, nsSocket::Recv. Patch by Ehsan Akhgari <ehsan.akhgari@gmail.com>, r=me

This commit is contained in:
ajschult%verizon.net 2006-08-30 05:10:47 +00:00
Родитель a055f75497
Коммит b292993aee
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -288,7 +288,7 @@ nsSocket::Send(unsigned char *aBuf, int *aBufSize)
int timeout = 0;
fd_set selset;
if (!aBuf || (aBufSize && (*aBufSize <= 0)) || mFd < 0)
if (!aBuf || !aBufSize || (*aBufSize <= 0) || mFd < 0)
return E_PARAM;
while (timeout < kTimeoutThresholdUsecs)
@ -355,7 +355,7 @@ nsSocket::Recv(unsigned char *aBuf, int *aBufSize, int aTimeoutThresholdUsecs)
int bufsize;
int timeout;
if (!aBuf || (aBufSize && (*aBufSize <= 0)) || mFd < 0)
if (!aBuf || !aBufSize || (*aBufSize <= 0) || mFd < 0)
return E_PARAM;
memset(aBuf, 0, *aBufSize);