@@ -240,23 +240,26 @@ protected void processControlService(ProtocolMessage msg) {
240240 // Assemble a security query payload header for our response
241241 SecurityQueryPayload responseHeader = new SecurityQueryPayload ();
242242
243+ byte [] returnBytes ;
243244 if (iNumBytes == null || iNumBytes <= 0 ) {
244245 DebugTool .logError (TAG , "Internal Error processing control service" );
245246
246247 responseHeader .setQueryID (SecurityQueryID .SEND_INTERNAL_ERROR );
247248 responseHeader .setQueryType (SecurityQueryType .NOTIFICATION );
248249 responseHeader .setCorrelationID (msg .getCorrID ());
249250 responseHeader .setJsonSize (0 );
251+ returnBytes = new byte [12 ];
250252 } else {
251253 responseHeader .setQueryID (SecurityQueryID .SEND_HANDSHAKE_DATA );
252254 responseHeader .setQueryType (SecurityQueryType .RESPONSE );
253255 responseHeader .setCorrelationID (msg .getCorrID ());
254256 responseHeader .setJsonSize (0 );
257+ returnBytes = new byte [iNumBytes + 12 ];
258+ System .arraycopy (dataToRead , 0 , returnBytes , 12 , iNumBytes );
255259 }
256260
257- byte [] returnBytes = new byte [ iNumBytes + 12 ];
261+
258262 System .arraycopy (responseHeader .assembleHeaderBytes (), 0 , returnBytes , 0 , 12 );
259- System .arraycopy (dataToRead , 0 , returnBytes , 12 , iNumBytes );
260263
261264 ProtocolMessage protocolMessage = new ProtocolMessage ();
262265 protocolMessage .setSessionType (SessionType .CONTROL );
0 commit comments