[asterisk-commits] rizzo: trunk r89268 - in /trunk: apps/ channels/ include/asterisk/ main/ pbx/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Nov 14 07:18:41 CST 2007
Author: rizzo
Date: Wed Nov 14 07:18:40 2007
New Revision: 89268
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89268
Log:
make the 'name' and 'value' fields in ast_variable const char *
This prevents modifying the strings in the stored variables,
and catched a few instances where this was actually done.
Given the differences between trunk and 1.4 (and the fact that this
is effectively an API change) it is better to fix 1.4 independently.
These are
chan_sip.c::sip_register()
chan_skinny.c:: near line 2847
config.c:: near line 1774
logger.c::make_components()
res_adsi.c:: near line 1049
I may have missed some instances for modules that do not build here.
Modified:
trunk/apps/app_directory.c
trunk/apps/app_minivm.c
trunk/apps/app_playback.c
trunk/apps/app_queue.c
trunk/apps/app_voicemail.c
trunk/channels/chan_agent.c
trunk/channels/chan_iax2.c
trunk/channels/chan_oss.c
trunk/channels/chan_sip.c
trunk/channels/chan_skinny.c
trunk/include/asterisk/abstract_jb.h
trunk/include/asterisk/acl.h
trunk/include/asterisk/config.h
trunk/main/abstract_jb.c
trunk/main/acl.c
trunk/main/config.c
trunk/main/enum.c
trunk/main/logger.c
trunk/main/manager.c
trunk/pbx/dundi-parser.c
trunk/pbx/dundi-parser.h
trunk/pbx/pbx_dundi.c
trunk/res/res_adsi.c
Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Wed Nov 14 07:18:40 2007
@@ -277,8 +277,8 @@
* '1' for selected entry from directory
* '*' for skipped entry from directory
*/
-static int play_mailbox_owner(struct ast_channel *chan, char *context,
- char *dialcontext, char *ext, char *name, int readext,
+static int play_mailbox_owner(struct ast_channel *chan, const char *context,
+ const char *dialcontext, const char *ext, const char *name, int readext,
int fromappvm)
{
int res = 0;
Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Wed Nov 14 07:18:40 2007
@@ -458,7 +458,7 @@
#define DEFAULT_CHARSET "ISO-8859-1"
/* Forward declarations */
-static char *message_template_parse_filebody(char *filename);
+static char *message_template_parse_filebody(const char *filename);
static char *message_template_parse_emailbody(const char *body);
static int create_vmaccount(char *name, struct ast_variable *var, int realtime);
static struct minivm_account *find_user_realtime(const char *domain, const char *username);
@@ -2182,7 +2182,7 @@
}
/*! \brief Add time zone to memory list */
-static int timezone_add(char *zonename, char *config)
+static int timezone_add(const char *zonename, const char *config)
{
struct minivm_zone *newzone;
@@ -2220,7 +2220,7 @@
}
/*! \brief Read message template from file */
-static char *message_template_parse_filebody(char *filename) {
+static char *message_template_parse_filebody(const char *filename) {
char buf[BUFSIZ * 6];
char readbuf[BUFSIZ];
char filenamebuf[BUFSIZ];
Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Wed Nov 14 07:18:40 2007
@@ -325,7 +325,7 @@
/*
* remap the 'say' functions to use those in this file
*/
-static int say_init_mode(char *mode) {
+static int say_init_mode(const char *mode) {
if (!strcmp(mode, say_new)) {
if (say_cfg == NULL) {
ast_log(LOG_ERROR, "There is no say.conf file to use new mode\n");
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Nov 14 07:18:40 2007
@@ -1242,7 +1242,8 @@
struct member *m;
struct ao2_iterator mem_iter;
char *interface = NULL;
- char *tmp, *tmp_name;
+ const char *tmp_name;
+ char *tmp;
char tmpbuf[64]; /* Must be longer than the longest queue param name. */
/* Static queues override realtime. */
@@ -1300,7 +1301,7 @@
if ((tmp = strchr(v->name, '_'))) {
ast_copy_string(tmpbuf, v->name, sizeof(tmpbuf));
tmp_name = tmpbuf;
- tmp = tmp_name;
+ tmp = tmpbuf;
while ((tmp = strchr(tmp, '_')))
*tmp++ = '-';
} else
@@ -2664,7 +2665,7 @@
const struct ast_channel *peer, const struct member *member, time_t callstart,
char *vars, size_t vars_len, enum agent_complete_reason rsn)
{
- const char *reason;
+ const char *reason = NULL; /* silence dumb compilers */
if (!qe->parent->eventwhencalled)
return;
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Wed Nov 14 07:18:40 2007
@@ -1652,7 +1652,7 @@
{
char frompath2[PATH_MAX], topath2[PATH_MAX];
struct ast_variable *tmp,*var = NULL;
- char *origmailbox = NULL, *context = NULL, *macrocontext = NULL, *exten = NULL, *priority = NULL, *callerchan = NULL, *callerid = NULL, *origdate = NULL, *origtime = NULL, *category = NULL, *duration = NULL;
+ const char *origmailbox = NULL, *context = NULL, *macrocontext = NULL, *exten = NULL, *priority = NULL, *callerchan = NULL, *callerid = NULL, *origdate = NULL, *origtime = NULL, *category = NULL, *duration = NULL;
ast_filecopy(frompath, topath, NULL);
snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
snprintf(topath2, sizeof(topath2), "%s.txt", topath);
@@ -7400,7 +7400,7 @@
return res;
}
-static struct ast_vm_user *find_or_create(char *context, char *mbox)
+static struct ast_vm_user *find_or_create(const char *context, const char *mbox)
{
struct ast_vm_user *vmu;
@@ -7425,7 +7425,7 @@
return vmu;
}
-static int append_mailbox(char *context, char *mbox, char *data)
+static int append_mailbox(const char *context, const char *mbox, const char *data)
{
/* Assumes lock is already held */
char *tmp;
Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Wed Nov 14 07:18:40 2007
@@ -267,7 +267,7 @@
* @return The just created agent.
* \sa agent_pvt, agents.
*/
-static struct agent_pvt *add_agent(char *agent, int pending)
+static struct agent_pvt *add_agent(const char *agent, int pending)
{
char *parse;
AST_DECLARE_APP_ARGS(args,
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Nov 14 07:18:40 2007
@@ -6287,7 +6287,7 @@
return 0;
}
-static int iax2_register(char *value, int lineno)
+static int iax2_register(const char *value, int lineno)
{
char copy[256];
char *username, *hostname, *secret;
@@ -9592,7 +9592,7 @@
return 0;
}
-static struct iax2_context *build_context(char *context)
+static struct iax2_context *build_context(const char *context)
{
struct iax2_context *con;
@@ -9602,7 +9602,7 @@
return con;
}
-static int get_auth_methods(char *value)
+static int get_auth_methods(const char *value)
{
int methods = 0;
if (strstr(value, "rsa"))
Modified: trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_oss.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Wed Nov 14 07:18:40 2007
@@ -212,7 +212,7 @@
* Likely we will come up with a better way of doing config file parsing.
*/
#define M_START(var, val) \
- char *__s = var; char *__val = val;
+ const char *__s = var; const char *__val = val;
#define M_END(x) x;
#define M_F(tag, f) if (!strcasecmp((__s), tag)) { f; } else
#define M_BOOL(tag, dst) M_F(tag, (dst) = ast_true(__val) )
@@ -1413,7 +1413,7 @@
/*!
* \brief store the boost factor
*/
-static void store_boost(struct chan_oss_pvt *o, char *s)
+static void store_boost(struct chan_oss_pvt *o, const char *s)
{
double boost = 0;
if (sscanf(s, "%lf", &boost) != 1) {
@@ -1472,7 +1472,7 @@
* invalid or dangerous values (the string is used as argument for
* system("mixer %s")
*/
-static void store_mixer(struct chan_oss_pvt *o, char *s)
+static void store_mixer(struct chan_oss_pvt *o, const char *s)
{
int i;
@@ -1491,7 +1491,7 @@
/*!
* store the callerid components
*/
-static void store_callerid(struct chan_oss_pvt *o, char *s)
+static void store_callerid(struct chan_oss_pvt *o, const char *s)
{
ast_callerid_split(s, o->cid_name, sizeof(o->cid_name), o->cid_num, sizeof(o->cid_num));
}
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Nov 14 07:18:40 2007
@@ -1572,7 +1572,7 @@
static void clear_sip_domains(void);
/*--- SIP realm authentication */
-static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char *configuration, int lineno);
+static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, const char *configuration, int lineno);
static int clear_realm_authentication(struct sip_auth *authlist); /* Clear realm authentication list (at reload) */
static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, const char *realm);
@@ -1686,7 +1686,7 @@
/*--- Internal UA client handling (outbound registrations) */
static void ast_sip_ouraddrfor(struct in_addr *them, struct sockaddr_in *us);
static void sip_registry_destroy(struct sip_registry *reg);
-static int sip_register(char *value, int lineno);
+static int sip_register(const char *value, int lineno);
static const char *regstate2str(enum sipregistrystate regstate) attribute_const;
static int sip_reregister(const void *data);
static int __sip_do_register(struct sip_registry *r);
@@ -5248,7 +5248,7 @@
}
/*! \brief Parse register=> line in sip.conf and add to registry */
-static int sip_register(char *value, int lineno)
+static int sip_register(const char *value, int lineno)
{
struct sip_registry *reg;
int portnum = 0;
@@ -12545,8 +12545,11 @@
initreqprep(&req, p, SIP_NOTIFY);
- for (var = varlist; var; var = var->next)
- add_header(&req, var->name, ast_unescape_semicolon(var->value));
+ for (var = varlist; var; var = var->next) {
+ char buf[512];
+ ast_copy_string(buf, var->value, sizeof(buf));
+ add_header(&req, var->name, ast_unescape_semicolon(buf));
+ }
/* Recalculate our side, and recalculate Call ID */
ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip);
@@ -17236,7 +17239,7 @@
/*! \brief Add realm authentication in list */
-static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char *configuration, int lineno)
+static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, const char *configuration, int lineno)
{
char authcopy[256];
char *username=NULL, *realm=NULL, *secret=NULL, *md5secret=NULL;
Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Wed Nov 14 07:18:40 2007
@@ -2847,8 +2847,10 @@
if (!(sd = ast_calloc(1, sizeof(*sd)))) {
return NULL;
} else {
- char *stringp, *exten, *context, *label;
- stringp = v->value;
+ char buf[256];
+ char *stringp = buf, *exten, *context, *label;
+
+ ast_copy_string(buf, v->value, sizeof(buf));
exten = strsep(&stringp, ",");
if ((context = strchr(exten, '@'))) {
*context++ = '\0';
Modified: trunk/include/asterisk/abstract_jb.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/abstract_jb.h?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/include/asterisk/abstract_jb.h (original)
+++ trunk/include/asterisk/abstract_jb.h Wed Nov 14 07:18:40 2007
@@ -193,7 +193,7 @@
*
* \return zero if the property was set to the configuration, -1 if not.
*/
-int ast_jb_read_conf(struct ast_jb_conf *conf, char *varname, char *value);
+int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *value);
/*!
Modified: trunk/include/asterisk/acl.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/acl.h?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/include/asterisk/acl.h (original)
+++ trunk/include/asterisk/acl.h Wed Nov 14 07:18:40 2007
@@ -56,7 +56,7 @@
void ast_free_ha(struct ast_ha *ha);
/*! \brief Append ACL entry to host access list. */
-struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path, int *error);
+struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha *path, int *error);
/*! \brief Check IP address with host access list */
int ast_apply_ha(struct ast_ha *ha, struct sockaddr_in *sin);
Modified: trunk/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/config.h?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/include/asterisk/config.h (original)
+++ trunk/include/asterisk/config.h Wed Nov 14 07:18:40 2007
@@ -50,16 +50,18 @@
/*! \brief Structure for variables, used for configurations and for channel variables
*/
struct ast_variable {
- char *name;
- char *value;
+ const char *name;
+ const char *value;
+ struct ast_variable *next;
+
char *file;
+
int lineno;
int object; /*!< 0 for variable, 1 for object */
int blanklines; /*!< Number of blanklines following entry */
struct ast_comment *precomments;
struct ast_comment *sameline;
struct ast_comment *trailing; /*!< the last object in the list will get assigned any trailing comments when EOF is hit */
- struct ast_variable *next;
char stuff[0];
};
Modified: trunk/main/abstract_jb.c
URL: http://svn.digium.com/view/asterisk/trunk/main/abstract_jb.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/main/abstract_jb.c (original)
+++ trunk/main/abstract_jb.c Wed Nov 14 07:18:40 2007
@@ -562,10 +562,10 @@
}
-int ast_jb_read_conf(struct ast_jb_conf *conf, char *varname, char *value)
+int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *value)
{
int prefixlen = sizeof(AST_JB_CONF_PREFIX) - 1;
- char *name;
+ const char *name;
int tmp;
if (strncasecmp(AST_JB_CONF_PREFIX, varname, prefixlen))
Modified: trunk/main/acl.c
URL: http://svn.digium.com/view/asterisk/trunk/main/acl.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/main/acl.c (original)
+++ trunk/main/acl.c Wed Nov 14 07:18:40 2007
@@ -120,7 +120,7 @@
return ret; /* Return start of list */
}
-struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path, int *error)
+struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha *path, int *error)
{
struct ast_ha *ha;
char *nm;
Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Wed Nov 14 07:18:40 2007
@@ -259,14 +259,16 @@
{
struct ast_variable *variable;
int name_len = strlen(name) + 1;
-
- if ((variable = ast_calloc(1, name_len + strlen(value) + 1 + strlen(filename) + 1 + sizeof(*variable)))) {
- variable->name = variable->stuff;
- variable->value = variable->stuff + name_len;
- variable->file = variable->stuff + name_len + strlen(value) + 1;
- strcpy(variable->name,name);
- strcpy(variable->value,value);
- strcpy(variable->file,filename);
+ int val_len = strlen(value) + 1;
+ int fn_len = strlen(filename) + 1;
+
+ if ((variable = ast_calloc(1, name_len + val_len + fn_len + sizeof(*variable)))) {
+ char *dst = variable->stuff; /* writable space starts here */
+ variable->name = strcpy(dst, name);
+ dst += name_len;
+ variable->value = strcpy(dst, value);
+ dst += fn_len;
+ variable->file = strcpy(dst, value);
}
return variable;
}
@@ -1721,7 +1723,7 @@
ast_mutex_unlock(&config_lock);
}
-static int append_mapping(char *name, char *driver, char *database, char *table)
+static int append_mapping(const char *name, const char *driver, const char *database, const char *table)
{
struct ast_config_map *map;
int length;
@@ -1772,7 +1774,9 @@
}
for (v = ast_variable_browse(config, "settings"); v; v = v->next) {
- stringp = v->value;
+ char buf[512];
+ ast_copy_string(buf, v->value, sizeof(buf));
+ stringp = buf;
driver = strsep(&stringp, ",");
if ((tmp = strchr(stringp, '\"')))
Modified: trunk/main/enum.c
URL: http://svn.digium.com/view/asterisk/trunk/main/enum.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/main/enum.c (original)
+++ trunk/main/enum.c Wed Nov 14 07:18:40 2007
@@ -594,7 +594,7 @@
}
/*! \brief Add enum tree to linked list */
-static struct enum_search *enum_newtoplev(char *s)
+static struct enum_search *enum_newtoplev(const char *s)
{
struct enum_search *tmp;
Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Wed Nov 14 07:18:40 2007
@@ -174,11 +174,11 @@
AST_THREADSTORAGE(log_buf);
#define LOG_BUF_INIT_SIZE 256
-static int make_components(char *s, int lineno)
+static int make_components(const char *s, int lineno)
{
char *w;
int res = 0;
- char *stringp = s;
+ char *stringp = ast_strdupa(s);
while ((w = strsep(&stringp, ","))) {
w = ast_skip_blanks(w);
@@ -204,7 +204,7 @@
return res;
}
-static struct logchannel *make_logchannel(char *channel, char *components, int lineno)
+static struct logchannel *make_logchannel(const char *channel, const char *components, int lineno)
{
struct logchannel *chan;
char *facility;
Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Wed Nov 14 07:18:40 2007
@@ -2973,9 +2973,9 @@
static void xml_translate(struct ast_str **out, char *in, struct ast_variable *vars, enum output_format format)
{
struct ast_variable *v;
- char *dest = NULL;
+ const char *dest = NULL;
char *var, *val;
- char *objtype = NULL;
+ const char *objtype = NULL;
int in_data = 0; /* parsing data */
int inobj = 0;
int xml = (format == FORMAT_XML);
Modified: trunk/pbx/dundi-parser.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/dundi-parser.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/pbx/dundi-parser.c (original)
+++ trunk/pbx/dundi-parser.c Wed Nov 14 07:18:40 2007
@@ -88,7 +88,7 @@
return os;
}
-int dundi_str_to_eid(dundi_eid *eid, char *s)
+int dundi_str_to_eid(dundi_eid *eid, const char *s)
{
unsigned int eid_int[6];
int x;
@@ -100,7 +100,7 @@
return 0;
}
-int dundi_str_short_to_eid(dundi_eid *eid, char *s)
+int dundi_str_short_to_eid(dundi_eid *eid, const char *s)
{
unsigned int eid_int[6];
int x;
Modified: trunk/pbx/dundi-parser.h
URL: http://svn.digium.com/view/asterisk/trunk/pbx/dundi-parser.h?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/pbx/dundi-parser.h (original)
+++ trunk/pbx/dundi-parser.h Wed Nov 14 07:18:40 2007
@@ -79,8 +79,8 @@
extern int dundi_parse_ies(struct dundi_ies *ies, unsigned char *data, int datalen);
extern char *dundi_eid_to_str(char *s, int maxlen, dundi_eid *eid);
extern char *dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid);
-extern int dundi_str_to_eid(dundi_eid *eid, char *s);
-extern int dundi_str_short_to_eid(dundi_eid *eid, char *s);
+extern int dundi_str_to_eid(dundi_eid *eid, const char *s);
+extern int dundi_str_short_to_eid(dundi_eid *eid, const char *s);
extern int dundi_eid_zero(dundi_eid *eid);
extern int dundi_eid_cmp(dundi_eid *eid1, dundi_eid *eid2);
extern char *dundi_flags2str(char *s, int maxlen, int flags);
Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Wed Nov 14 07:18:40 2007
@@ -4219,7 +4219,7 @@
AST_LIST_UNLOCK(&peers);
}
-static void append_permission(struct permissionlist *permlist, char *s, int allow)
+static void append_permission(struct permissionlist *permlist, const char *s, int allow)
{
struct permission *perm;
@@ -4234,7 +4234,7 @@
#define MAX_OPTS 128
-static void build_mapping(char *name, char *value)
+static void build_mapping(const char *name, const char *value)
{
char *t, *fields[MAX_OPTS];
struct dundi_mapping *map;
Modified: trunk/res/res_adsi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_adsi.c?view=diff&rev=89268&r1=89267&r2=89268
==============================================================================
--- trunk/res/res_adsi.c (original)
+++ trunk/res/res_adsi.c Wed Nov 14 07:18:40 2007
@@ -70,7 +70,8 @@
static char intro[ADSI_MAX_INTRO][20];
static int aligns[ADSI_MAX_INTRO];
-static char speeddial[ADSI_MAX_SPEED_DIAL][3][20];
+#define SPEEDDIAL_MAX_LEN 20
+static char speeddial[ADSI_MAX_SPEED_DIAL][3][SPEEDDIAL_MAX_LEN];
static int alignment = 0;
@@ -988,7 +989,7 @@
return 0;
}
-static int str2align(char *s)
+static int str2align(const char *s)
{
if (!strncasecmp(s, "l", 1))
return ADSI_JUST_LEFT;
@@ -1048,7 +1049,9 @@
x = 0;
for (v = ast_variable_browse(conf, "speeddial"); v; v = v->next) {
- char *stringp = v->value;
+ char buf[3 * SPEEDDIAL_MAX_LEN];
+ char *stringp = buf;
+ ast_copy_string(buf, v->value, sizeof(buf));
name = strsep(&stringp, ",");
sname = strsep(&stringp, ",");
if (!sname)
More information about the asterisk-commits
mailing list