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

cmapctl: check NULL for key type and value for -p

To avoid segmentation fault.

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
(cherry picked from commit ec889e89c62f365aef7555a50a156b41fb142069)
liangxin1300 5 жил өмнө
parent
commit
4e61fb0560

+ 4 - 0
tools/corosync-cmapctl.c

@@ -735,6 +735,10 @@ static void read_in_config_file(cmap_handle_t handle, char * filename)
 		} else {
 			key_type_s = strtok(NULL, " \n");
 			key_value_s = strtok(NULL, " \n");
+			if (key_type_s == NULL || key_value_s == NULL) {
+				fprintf(stderr, "Both type and value for key %s are required\n", key_name);
+				exit (EXIT_FAILURE);
+			}
 			set_key(handle, key_name, key_type_s, key_value_s);
 		}
 	}