Procházet zdrojové kódy

ipc: Check for the libraries sending invalid message IDs

If the library sent an invalid (ie too high) message ID to
corosync, then it could cause the daemon to crash.

Now we check the message ID before indexing the function array

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield před 8 roky
rodič
revize
876910d8ff
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      exec/main.c

+ 5 - 0
exec/main.c

@@ -758,6 +758,11 @@ int corosync_sending_allowed (
 		return -EINVAL;
 	}
 
+	/* Message ID out of range */
+	if (id >= corosync_service[service]->lib_engine_count) {
+		return -EINVAL;
+	}
+
 	sending_allowed = QB_FALSE;
 	if (corosync_quorum_is_quorate() == 1 ||
 	    corosync_service[service]->allow_inquorate == CS_LIB_ALLOW_INQUORATE) {