~davewalker/ubuntu/maverick/asterisk/lp_705014

« back to all changes in this revision

Viewing changes to apps/app_cut.c

  • Committer: Bazaar Package Importer
  • Author(s): Kilian Krause
  • Date: 2005-03-09 22:09:05 UTC
  • mto: (1.2.1 upstream) (8.2.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050309220905-9afy6hcpw96xbr6j
Tags: upstream-1.0.6
ImportĀ upstreamĀ versionĀ 1.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *
6
6
 * Copyright (c) 2003 Tilghman Lesher.  All rights reserved.
7
7
 *
8
 
 * Tilghman Lesher <app_cut__v002@the-tilghman.com>
 
8
 * Tilghman Lesher <app_cut__v003@the-tilghman.com>
9
9
 *
10
 
 * $Id: app_cut.c,v 1.3.2.1 2004/02/24 18:58:04 markster Exp $
 
10
 * $Id: app_cut.c,v 1.6 2004/07/14 07:22:30 markster Exp $
11
11
 *
12
12
 * This code is released by the author with no restrictions on usage.
13
13
 *
82
82
        if (args_okay) {
83
83
                char d, ds[2];
84
84
                char *tmp = alloca(strlen(varname) + 4);
85
 
                char *tmp2 = alloca(MAXRESULT);
 
85
                char varvalue[MAXRESULT], *tmp2=varvalue;
86
86
                char retstring[MAXRESULT];
87
87
 
88
 
                if (tmp2)
89
 
                        memset(tmp2, 0, MAXRESULT);
90
88
                memset(retstring, 0, MAXRESULT);
91
89
 
92
 
                if (tmp && tmp2) {
 
90
                if (tmp) {
93
91
                        snprintf(tmp, strlen(varname) + 4, "${%s}", varname);
94
 
                        memset(tmp2, 0, sizeof(tmp2));
 
92
                        memset(varvalue, 0, sizeof(varvalue));
95
93
                } else {
96
94
                        ast_log(LOG_ERROR, "Out of memory");
97
95
                        return -1;
103
101
                        d = '-';
104
102
 
105
103
                /* String form of the delimiter, for use with strsep(3) */
106
 
                sprintf(ds,"%c",d);
 
104
                snprintf(ds, sizeof(ds), "%c", d);
107
105
 
108
106
                pbx_substitute_variables_helper(chan, tmp, tmp2, MAXRESULT - 1);
109
107