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

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 5 15:20:24 CEST 2014


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

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

(cherry picked from commit 1faf19fa7d34528b6cc15ffcb1ec91a6c6074e90)

---

 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