]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Use ast_strdup() instead of ast_strdupa() while processing in ast_hint_state_changed().
authorMatthew Nicholson <mnicholson@digium.com>
Fri, 17 Sep 2010 13:34:34 +0000 (13:34 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Fri, 17 Sep 2010 13:34:34 +0000 (13:34 +0000)
(related to issue #17928)
Reported by: mdu113

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@287307 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/pbx.c

index 67d4ac71a974e4ddf2297867fca8fc1a7f3e3ba7..c232b9bb2092431868194872e9da02225a4d7043 100644 (file)
@@ -2017,14 +2017,19 @@ void ast_hint_state_changed(const char *device)
 
        AST_LIST_TRAVERSE(&hints, hint, list) {
                struct ast_state_cb *cblist;
-               char *parse = ast_strdupa(ast_get_extension_app(hint->exten));
-               char *cur;
+               /* can't use ast_strdupa() here because we may run out of stack
+                * space while looping over a large number of large strings */
+               char *dup = ast_strdup(ast_get_extension_app(hint->exten));
+               char *cur, *parse = dup;
                int state;
 
                while ( (cur = strsep(&parse, "&")) ) {
                        if (!strcasecmp(cur, device))
                                break;
                }
+
+               ast_free(dup);
+
                if (!cur)
                        continue;