Explorar o código

core: reset cur_opt shortcut after use, it points to local variable

- safety to prevent invalid access on future extensions
Daniel-Constantin Mierla %!s(int64=11) %!d(string=hai) anos
pai
achega
1faf19fa7d
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      cfg_parser.c

+ 2 - 1
cfg_parser.c

@@ -732,7 +732,8 @@ int sr_cfg_parse(cfg_parser_t* st)
 			}
 
 			st->cur_opt = &t;
-			if (process_option(st, opt) < 0) return -1;
+			if (process_option(st, opt) < 0) { st->cur_opt = 0; return -1; }
+			st->cur_opt = 0;
 			break;
 
 		case '[':