Explorar o código

totemsrp: Add assert into memb_lowest_in_config

Add assert when there are no members in token_memb structure so
non-existing member is not accessed (token should always have
at least one member).

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse %!s(int64=7) %!d(string=hai) anos
pai
achega
f60541513e
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      exec/totemsrp.c

+ 1 - 0
exec/totemsrp.c

@@ -3156,6 +3156,7 @@ static int memb_lowest_in_config (struct totemsrp_instance *instance)
 	/*
 	 * find representative by searching for smallest identifier
 	 */
+	assert(token_memb_entries > 0);
 
 	lowest_nodeid = token_memb[0].nodeid;
 	for (i = 1; i < token_memb_entries; i++) {