[sr-dev] git:master: core: reset cur_opt shortcut after use, it points to local variable

Daniel-Constantin Mierla miconda at gmail.com
Mon Jun 30 12:12:37 CEST 2014


Module: sip-router
Branch: master
Commit: 1faf19fa7d34528b6cc15ffcb1ec91a6c6074e90
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1faf19fa7d34528b6cc15ffcb1ec91a6c6074e90

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Jun 30 12:05:19 2014 +0200

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

- safety to prevent invalid access on future extensions

---

 cfg_parser.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/cfg_parser.c b/cfg_parser.c
index fa8721b..594eb8e 100644
--- a/cfg_parser.c
+++ b/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 '[': 




More information about the sr-dev mailing list