Explorar o código

coroparse: Check emptiness of key name

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse hai 9 meses
pai
achega
ff1039960a
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      exec/coroparse.c

+ 5 - 0
exec/coroparse.c

@@ -411,6 +411,11 @@ static int parse_section(FILE *fp,
 			key = remove_whitespace(line, 1);
 			key = remove_whitespace(line, 1);
 			value = remove_whitespace(loc, 0);
 			value = remove_whitespace(loc, 0);
 
 
+			if (strlen(key) == 0) {
+				tmp_error_string = "Key name can't be empty";
+				goto parse_error;
+			}
+
 			if (strlen(path) + strlen(key) + 1 >= ICMAP_KEYNAME_MAXLEN) {
 			if (strlen(path) + strlen(key) + 1 >= ICMAP_KEYNAME_MAXLEN) {
 				tmp_error_string = "New key makes total cmap path too long";
 				tmp_error_string = "New key makes total cmap path too long";
 				goto parse_error;
 				goto parse_error;