disconnect servers that send missaligned protocol
This commit is contained in:
+1
-2
@@ -1091,8 +1091,7 @@ bool tcpiiu::processIncoming (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for 8 byte aligned protocol
|
// check for 8 byte aligned protocol
|
||||||
if ( ( ( this->curMsg.m_postsize >> 3 ) << 3 )
|
if ( this->curMsg.m_postsize & 0x7 ) {
|
||||||
!= this->curMsg.m_postsize ) {
|
|
||||||
this->printf ( mgr.cbGuard,
|
this->printf ( mgr.cbGuard,
|
||||||
"CAC: server sent missaligned payload 0x%x\n",
|
"CAC: server sent missaligned payload 0x%x\n",
|
||||||
this->curMsg.m_postsize );
|
this->curMsg.m_postsize );
|
||||||
|
|||||||
@@ -781,6 +781,13 @@ caStatus casDGClient::processMsg ()
|
|||||||
msgTmp.m_cid = epicsNTOH32 ( smallHdr.m_cid );
|
msgTmp.m_cid = epicsNTOH32 ( smallHdr.m_cid );
|
||||||
msgTmp.m_available = epicsNTOH32 ( smallHdr.m_available );
|
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;
|
msgSize = hdrSize + payloadSize;
|
||||||
if ( bytesLeft < msgSize ) {
|
if ( bytesLeft < msgSize ) {
|
||||||
|
|||||||
@@ -181,11 +181,11 @@ caStatus casStrmClient::processMsg ()
|
|||||||
msgTmp.m_available = epicsNTOH32 ( smallHdr.m_available );
|
msgTmp.m_available = epicsNTOH32 ( smallHdr.m_available );
|
||||||
|
|
||||||
// disconnect clients that dont send 8 byte aligned payloads
|
// 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,
|
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,
|
status = this->sendErr ( guard, & msgTmp, invalidResID, ECA_INTERNAL,
|
||||||
"Missaligned protocol rejected" );
|
"Stream request wasn't 8 byte aligned" );
|
||||||
status = S_cas_internal;
|
status = S_cas_internal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2318,7 +2318,7 @@ int camessage ( struct client *client )
|
|||||||
* disconnect clients that dont send 8 byte
|
* disconnect clients that dont send 8 byte
|
||||||
* aligned payloads
|
* aligned payloads
|
||||||
*/
|
*/
|
||||||
if ( ( ( msgsize >> 3 ) << 3 ) != msgsize ) {
|
if ( msgsize & 0x7 ) {
|
||||||
send_err ( &msg, ECA_INTERNAL, client,
|
send_err ( &msg, ECA_INTERNAL, client,
|
||||||
"CAS: Missaligned protocol rejected" );
|
"CAS: Missaligned protocol rejected" );
|
||||||
log_header ( "CAS: Missaligned protocol rejected",
|
log_header ( "CAS: Missaligned protocol rejected",
|
||||||
|
|||||||
Reference in New Issue
Block a user