Prevent hang in ReadSecret when buffer is too small

This commit is contained in:
Jim Norman 2006-09-29 22:38:33 +00:00
parent dd5bef3c2a
commit af226ee216

View File

@ -1108,14 +1108,13 @@ int32_t ipc_ReadSecret
n = dataLen; n = dataLen;
while(n) while(n)
{ {
int bytes = IPC_READ(ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN); int bytesRead = IPC_READ(ssHandle->platHandle, gpReplyBuf, n);
if( bytes > 0) if( bytesRead > 0)
n -= MIN_REPLY_BUF_LEN; n -= bytesRead;
else else
break; break;
} }
// Read the sscs return code also.
IPC_READ(ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
retCode = NSSCS_E_ENUM_BUFF_TOO_SHORT; retCode = NSSCS_E_ENUM_BUFF_TOO_SHORT;
break; break;
} }