disconnect servers that send missaligned protocol

This commit is contained in:
Jeff Hill
2004-06-14 17:45:43 +00:00
parent 1a6c1caa54
commit da5bc3b820
4 changed files with 12 additions and 6 deletions

View File

@@ -1091,8 +1091,7 @@ bool tcpiiu::processIncoming (
}
// check for 8 byte aligned protocol
if ( ( ( this->curMsg.m_postsize >> 3 ) << 3 )
!= this->curMsg.m_postsize ) {
if ( this->curMsg.m_postsize & 0x7 ) {
this->printf ( mgr.cbGuard,
"CAC: server sent missaligned payload 0x%x\n",
this->curMsg.m_postsize );

View File

@@ -781,6 +781,13 @@ caStatus casDGClient::processMsg ()
msgTmp.m_cid = epicsNTOH32 ( smallHdr.m_cid );
msgTmp.m_available = epicsNTOH32 ( smallHdr.m_available );
if ( payloadSize & 0x7 ) {
status = this->sendErr (
& msgTmp, invalidResID, ECA_INTERNAL,
"CAS: Datagram request wasn't 8 byte aligned" );
this->in.removeMsg ( bytesLeft );
break;
}
msgSize = hdrSize + payloadSize;
if ( bytesLeft < msgSize ) {

View File

@@ -181,11 +181,11 @@ caStatus casStrmClient::processMsg ()
msgTmp.m_available = epicsNTOH32 ( smallHdr.m_available );
// disconnect clients that dont send 8 byte aligned payloads
if ( ( ( payloadSize >> 3 ) << 3 ) != payloadSize ) {
if ( payloadSize & 0x7 ) {
caServerI::dumpMsg ( this->pHostName, this->pUserName, & msgTmp, 0,
"CAS: Missaligned protocol rejected\n" );
"CAS: Stream request wasn't 8 byte aligned\n" );
status = this->sendErr ( guard, & msgTmp, invalidResID, ECA_INTERNAL,
"Missaligned protocol rejected" );
"Stream request wasn't 8 byte aligned" );
status = S_cas_internal;
break;
}

View File

@@ -2318,7 +2318,7 @@ int camessage ( struct client *client )
* disconnect clients that dont send 8 byte
* aligned payloads
*/
if ( ( ( msgsize >> 3 ) << 3 ) != msgsize ) {
if ( msgsize & 0x7 ) {
send_err ( &msg, ECA_INTERNAL, client,
"CAS: Missaligned protocol rejected" );
log_header ( "CAS: Missaligned protocol rejected",