Explorar o código

konfd: Fix segmentation fault while del_pattern operation

Serj Kalichev %!s(int64=3) %!d(string=hai) anos
pai
achega
eeb753f099
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      konf/tree/tree.c

+ 4 - 0
konf/tree/tree.c

@@ -250,6 +250,10 @@ int konf_tree_del_pattern(konf_tree_t *this,
 	if (!(iter = lub_list__get_head(this->list)))
 		return 0;
 
+	/* Pattern is not specified */
+	if (!pattern)
+		return -1;
+
 	/* Compile regular expression */
 	if (regcomp(&regexp, pattern, REG_EXTENDED | REG_ICASE) != 0)
 		return -1;