Modifications to resolve issues found during self-code review.

This commit is contained in:
Juan Carlos Luciani
2006-12-08 05:45:03 +00:00
parent 9a0426279c
commit 8ade751650
34 changed files with 524 additions and 268 deletions

View File

@@ -234,15 +234,15 @@ SChannel::connectionThread(
{
SChannel *pSChannel = *pSmartSChannel;
bool doneReceivingData = false;
unsigned long bytesReceived;
int32_t bytesReceived;
unsigned long bytesSent;
uint32_t reqId;
int payloadLength;
int32_t payloadLength;
unsigned long totalPayloadBytesReceived = 0;
char reqDataPktHdr[ReqDataPktHdrTemplate.length()];
char reqErrorPktHdr[ReqErrorPktHdrTemplate.length()];
char *pRecvBuff;
ServerReq *pServerReq;
ServerReq *pServerReq = NULL;
DbgTrace(1, "SChannel::connectionThread- Start, Obj = %0X\n", pSChannel);
@@ -285,7 +285,7 @@ SChannel::connectionThread(
&payloadLength))
{
// Procced based on the packet type
switch (ChannelProto::getPktType(*reqDataPktHdr))
switch (ChannelProto::getPktType(*reqDataPktHdr, sizeof(reqDataPktHdr)))
{
case ChannelProto::ReqDataCarrierPacketType:

View File

@@ -101,13 +101,13 @@ pthread_mutex_t interlockedMutex;
typedef map<int32_t, ServerReq*> RSMap;
typedef RSMap::iterator RSMapIter;
typedef pair<RSMapIter, bool> RSIterBoolPair;
RSMap rsMap;
RSMap rsMap;
int numActiveRequests = 0;
//
// Next request id (Can not be zero)
//
int32_t nextReqId = 1;
uint32_t nextReqId = 1;
//
// Pending ServerRequests List and count - Server requests are staged on this lists until
@@ -436,15 +436,25 @@ BindSocket(int socketToBind)
// Remove pre-existing socket
unlink(listenSocketFile);
// Setup the address that the daemon will use to listen
// for connections.
listenAddr.sun_family = AF_UNIX;
strcpy(listenAddr.sun_path, listenSocketFile);
// Verify that the specified path is not too long
if (strlen(listenSocketFile) < sizeof(sizeof(listenAddr.sun_path)))
{
// Setup the address that the daemon will use to listen
// for connections.
listenAddr.sun_family = AF_UNIX;
strncpy(listenAddr.sun_path, listenSocketFile, sizeof(listenAddr.sun_path) - 1);
// Perform the bind operation
retStatus = bind(socketToBind,
(const sockaddr*) &listenAddr,
sizeof(listenAddr.sun_family) + strlen(listenAddr.sun_path));
// Perform the bind operation
retStatus = bind(socketToBind,
(const sockaddr*) &listenAddr,
sizeof(listenAddr.sun_family) + strlen(listenAddr.sun_path));
}
else
{
DbgTrace(0, "BindSocket- Listen socket file path too long\n", 0);
errno = ERANGE;
retStatus = -1;
}
// Return the file creation mask to its previous value
umask(prevMask);
@@ -688,7 +698,7 @@ void* ServiceConnectionsThread(void)
//++=======================================================================
extern "C"
int32_t
uint32_t
IpcServerGetRequest(void)
//
// Arguments In: None.
@@ -813,7 +823,7 @@ exit:
extern "C"
int32_t
IpcServerGetRequestData(
IN int32_t requestId,
IN uint32_t requestId,
INOUT char **ppReqData)
//
// Arguments In: requestId - The id of the request being processed.
@@ -884,7 +894,7 @@ IpcServerGetRequestData(
extern "C"
void
IpcServerCompleteRequest(
IN int32_t requestId,
IN uint32_t requestId,
IN char *pReplyData)
//
// Arguments In: requestId - The id of the request being completed.
@@ -950,7 +960,7 @@ IpcServerCompleteRequest(
extern "C"
void
IpcServerAbortRequest(
IN int32_t requestId)
IN uint32_t requestId)
//
// Arguments In: requestId - The id of the request being aborted.
//
@@ -1246,7 +1256,7 @@ IpcServerInit(
DbgTrace(1, "IpcServerInit- Start\n", 0);
// Check input parameters
if (pAppName == NULL)
if (pName == NULL)
{
DbgTrace(0, "IpcServerInit- Invalid parameter\n", 0);
goto exit;