Przeglądaj źródła

Provide better checking of the message type

A negative value for the message type (on systems where char is signed)
would cause a crash. This is highly probable if the cluster is, for example,
misconfigured to have encryption enabled on some nodes but not others.

Signed-off-by: Zane Bitter <zane.bitter@gmail.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Zane Bitter 15 lat temu
rodzic
commit
7e368581e9
1 zmienionych plików z 4 dodań i 8 usunięć
  1. 4 8
      exec/totemsrp.c

+ 4 - 8
exec/totemsrp.c

@@ -4360,13 +4360,6 @@ void main_deliver_fn (
 		return;
 	}
 
-	if ((int)message_header->type >= totemsrp_message_handlers.count) {
-		log_printf (instance->totemsrp_log_level_security, "Type of received message is wrong...  ignoring %d.\n", (int)message_header->type);
-printf ("wrong message type\n");
-		instance->stats.rx_msg_dropped++;
-		return;
-	}
-
 	switch (message_header->type) {
 	case MESSAGE_TYPE_ORF_TOKEN:
 		instance->stats.orf_token_rx++;
@@ -4387,7 +4380,10 @@ printf ("wrong message type\n");
 		instance->stats.token_hold_cancel_rx++;
 		break;
 	default:
-		break;
+		log_printf (instance->totemsrp_log_level_security, "Type of received message is wrong...  ignoring %d.\n", (int)message_header->type);
+printf ("wrong message type\n");
+		instance->stats.rx_msg_dropped++;
+		return;
 	}
 	/*
 	 * Handle incoming message