diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-25 14:32:08 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-25 14:32:08 +0000 |
commit | 000e0986072e528276eb7ea9a37728b5b0e6be76 (patch) | |
tree | b186c37b5085861c464a92debbf99dd8c2b71780 /channels/chan_phone.c | |
parent | c3ad9c9ef53aa9d4297f7c0f009da3c33f50bebc (diff) |
apparently developers are still not aware that they should be use ast_copy_string instead of strncpy... fix up many more users, and fix some bugs in the process
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46200 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_phone.c')
-rw-r--r-- | channels/chan_phone.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/channels/chan_phone.c b/channels/chan_phone.c index f6380ba63..91854b7ad 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -312,12 +312,12 @@ static int phone_call(struct ast_channel *ast, char *dest, int timeout) } /* the standard format of ast->callerid is: "name" <number>, but not always complete */ if (ast_strlen_zero(ast->cid.cid_name)) - strncpy(cid.name, DEFAULT_CALLER_ID, sizeof(cid.name) - 1); + strcpy(cid.name, DEFAULT_CALLER_ID); else - strncpy(cid.name, ast->cid.cid_name, sizeof(cid.name) - 1); + ast_copy_string(cid.name, ast->cid.cid_name, sizeof(cid.name)); if (ast->cid.cid_num) - strncpy(cid.number, ast->cid.cid_num, sizeof(cid.number) - 1); + ast_copy_string(cid.number, ast->cid.cid_num, sizeof(cid.number)); p = ast->tech_pvt; @@ -866,11 +866,11 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte if (state == AST_STATE_RING) tmp->rings = 1; tmp->tech_pvt = i; - strncpy(tmp->context, context, sizeof(tmp->context)-1); + ast_copy_string(tmp->context, context, sizeof(tmp->context)); if (!ast_strlen_zero(i->ext)) - strncpy(tmp->exten, i->ext, sizeof(tmp->exten)-1); + ast_copy_string(tmp->exten, i->ext, sizeof(tmp->exten)); else - strncpy(tmp->exten, "s", sizeof(tmp->exten) - 1); + strcpy(tmp->exten, "s"); if (!ast_strlen_zero(i->language)) ast_string_field_set(tmp, language, i->language); @@ -1200,15 +1200,15 @@ static struct phone_pvt *mkif(char *iface, int mode, int txgain, int rxgain) tmp->lastinput = -1; tmp->ministate = 0; memset(tmp->ext, 0, sizeof(tmp->ext)); - strncpy(tmp->language, language, sizeof(tmp->language)-1); - strncpy(tmp->dev, iface, sizeof(tmp->dev)-1); - strncpy(tmp->context, context, sizeof(tmp->context)-1); + ast_copy_string(tmp->language, language, sizeof(tmp->language)); + ast_copy_string(tmp->dev, iface, sizeof(tmp->dev)); + ast_copy_string(tmp->context, context, sizeof(tmp->context)); tmp->next = NULL; tmp->obuflen = 0; tmp->dialtone = 0; tmp->cpt = 0; - strncpy(tmp->cid_num, cid_num, sizeof(tmp->cid_num)-1); - strncpy(tmp->cid_name, cid_name, sizeof(tmp->cid_name)-1); + ast_copy_string(tmp->cid_num, cid_num, sizeof(tmp->cid_num)); + ast_copy_string(tmp->cid_name, cid_name, sizeof(tmp->cid_name)); tmp->txgain = txgain; ioctl(tmp->fd, PHONE_PLAY_VOLUME, tmp->txgain); tmp->rxgain = rxgain; @@ -1379,7 +1379,7 @@ static int load_module(void) } else if (!strcasecmp(v->name, "silencesupression")) { silencesupression = ast_true(v->value); } else if (!strcasecmp(v->name, "language")) { - strncpy(language, v->value, sizeof(language)-1); + ast_copy_string(language, v->value, sizeof(language)); } else if (!strcasecmp(v->name, "callerid")) { ast_callerid_split(v->value, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num)); } else if (!strcasecmp(v->name, "mode")) { @@ -1398,7 +1398,7 @@ static int load_module(void) else ast_log(LOG_WARNING, "Unknown mode: %s\n", v->value); } else if (!strcasecmp(v->name, "context")) { - strncpy(context, v->value, sizeof(context)-1); + ast_copy_string(context, v->value, sizeof(context)); } else if (!strcasecmp(v->name, "format")) { if (!strcasecmp(v->value, "g723.1")) { prefformat = AST_FORMAT_G723_1; |