Skip to content

Commit a9c8fd8

Browse files
HeniganHenigan
authored andcommitted
Fix bulkData and add null check
1 parent 197937e commit a9c8fd8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

base/src/main/java/com/smartdevicelink/protocol/SecurityQueryPayload.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ public static SecurityQueryPayload parseBinaryQueryHeader(byte[] binHeader) {
5555
byte[] _bulkData;
5656
if (msg.getQueryType() == QueryType.NOTIFICATION && msg.getQueryID() == QueryID.SEND_INTERNAL_ERROR) {
5757
_bulkData = new byte[binHeader.length - _jsonSize - 12 - 1];
58-
System.arraycopy(binHeader, 12 + _jsonSize, _bulkData, 0, _bulkData.length - 1);
5958
} else {
6059
_bulkData = new byte[binHeader.length - _jsonSize - 12];
61-
System.arraycopy(binHeader, 12 + _jsonSize, _bulkData, 0, _bulkData.length);
6260
}
61+
System.arraycopy(binHeader, 12 + _jsonSize, _bulkData, 0, _bulkData.length);
6362
msg.setBulkData(_bulkData);
6463
}
6564

base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ protected void processControlService(ProtocolMessage msg) {
192192
return;
193193

194194
SecurityQueryPayload receivedHeader = SecurityQueryPayload.parseBinaryQueryHeader(msg.getData().clone());
195+
if (receivedHeader == null) {
196+
DebugTool.logError(TAG, "Malformed Security Query Header");
197+
return;
198+
}
195199

196200
int iLen = msg.getData().length - 12;
197201
byte[] data = new byte[iLen];

0 commit comments

Comments
 (0)