Эх сурвалжийг харах

adsprpc: Add check to prevent out of bound access

Add -ve value check for index to prevent the array out of bound access.

Change-Id: I0d23e2cb258227ef76779d82ec2c8f6b9cf7f95f
Signed-off-by: rnallago <[email protected]>
rnallago 1 жил өмнө
parent
commit
a4befa3f75
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  1. 2 2
      dsp/adsprpc_socket.c

+ 2 - 2
dsp/adsprpc_socket.c

@@ -139,7 +139,7 @@ inline int verify_transport_device(int cid, int tvm_remote_domain)
 	struct frpc_transport_session_control *session_control = NULL;
 
 	remote_domain = tvm_remote_domain;
-	VERIFY(err, remote_domain < MAX_REMOTE_ID);
+	VERIFY(err, remote_domain >= 0 && remote_domain < MAX_REMOTE_ID);
 	if (err) {
 		err = -ECHRNG;
 		goto bail;
@@ -393,7 +393,7 @@ int fastrpc_transport_send(int cid, void *rpc_msg, uint32_t rpc_msg_size, int tv
 	struct kvec msg = {0};
 
 	remote_domain = tvm_remote_domain;
-	VERIFY(err, remote_domain < MAX_REMOTE_ID);
+	VERIFY(err, remote_domain >= 0 && remote_domain < MAX_REMOTE_ID);
 	if (err) {
 		err = -ECHRNG;
 		goto bail;