aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-10-18 16:47:57 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-10-18 16:47:57 +0000
commit3b0ed1ec21c33db5533265e3f0339074324e2817 (patch)
treee6f64a0d6ef32dc8598367c752db154a16cf3a4b
parent45ac69512b3210e5e4bd6e0b5c66d615f7b47c4e (diff)
Version 0.1.10 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@376 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_record.c2
-rwxr-xr-xapps/app_url.c2
-rwxr-xr-xchannels/chan_modem.c38
-rwxr-xr-xchannels/chan_modem_aopen.c8
-rwxr-xr-xchannels/chan_modem_bestdata.c8
-rwxr-xr-xchannels/chan_oss.c18
-rwxr-xr-xchannels/chan_phone.c20
-rwxr-xr-xchannels/chan_vofr.c18
-rwxr-xr-xcli.c2
-rwxr-xr-xfile.c10
-rwxr-xr-ximage.c2
11 files changed, 64 insertions, 64 deletions
diff --git a/apps/app_record.c b/apps/app_record.c
index 4703ade72..d5937b6ee 100755
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -89,7 +89,7 @@ static int record_exec(struct ast_channel *chan, void *data)
count++;
} while ( ast_fileexists(tmp, ext, chan->language) != -1 );
} else
- strncpy(tmp, fil, 256);
+ strncpy(tmp, fil, 256-1);
/* end of routine mentioned */
LOCAL_USER_ADD(u);
diff --git a/apps/app_url.c b/apps/app_url.c
index 542c490a7..7e6036140 100755
--- a/apps/app_url.c
+++ b/apps/app_url.c
@@ -55,7 +55,7 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n");
return -1;
}
- strncpy(tmp, (char *)data, sizeof(tmp));
+ strncpy(tmp, (char *)data, sizeof(tmp)-1);
strtok(tmp, "|");
options = strtok(NULL, "|");
if (options && !strcasecmp(options, "wait"))
diff --git a/channels/chan_modem.c b/channels/chan_modem.c
index ea5757e2f..fb4f236e1 100755
--- a/channels/chan_modem.c
+++ b/channels/chan_modem.c
@@ -165,7 +165,7 @@ static int modem_call(struct ast_channel *ast, char *idest, int timeout)
struct ast_modem_pvt *p;
int ms = timeout;
char rdest[80], *where, dstr[100];
- strncpy(rdest, idest, sizeof(rdest));
+ strncpy(rdest, idest, sizeof(rdest)-1);
strtok(rdest, ":");
where = strtok(NULL, ":");
if (!where) {
@@ -245,7 +245,7 @@ int ast_modem_read_response(struct ast_modem_pvt *p, int timeout)
do {
res = ast_waitfor_n_fd(&p->fd, 1, &timeout, NULL);
if (res < 0) {
- strncpy(p->response, "(No Response)", sizeof(p->response));
+ strncpy(p->response, "(No Response)", sizeof(p->response)-1);
return -1;
}
/* get no more then buffer length */
@@ -257,7 +257,7 @@ int ast_modem_read_response(struct ast_modem_pvt *p, int timeout)
/* if nothing in buffer, go back into timeout stuff */
if (errno == EWOULDBLOCK) break;
/* return as error */
- strncpy(p->response, "(No Response)", sizeof(p->response));
+ strncpy(p->response, "(No Response)", sizeof(p->response)-1);
return -1;
}
/* save char */
@@ -281,7 +281,7 @@ int ast_modem_read_response(struct ast_modem_pvt *p, int timeout)
}
}
} while(timeout > 0);
- strncpy(p->response, "(No Response)", sizeof(p->response));
+ strncpy(p->response, "(No Response)", sizeof(p->response)-1);
return -1;
}
@@ -289,7 +289,7 @@ int ast_modem_expect(struct ast_modem_pvt *p, char *result, int timeout)
{
int res = -1;
timeout *= 1000;
- strncpy(p->response, "(No Response)", sizeof(p->response));
+ strncpy(p->response, "(No Response)", sizeof(p->response)-1);
do {
res = ast_waitfor_n_fd(&p->fd, 1, &timeout, NULL);
if (res < 0) {
@@ -363,7 +363,7 @@ static int modem_setup(struct ast_modem_pvt *p, int baudrate)
ast_log(LOG_WARNING, "Modem did not provide identification\n");
return -1;
}
- strncpy(identity, p->response, sizeof(identity));
+ strncpy(identity, p->response, sizeof(identity)-1);
ast_modem_trim(identity);
if (ast_modem_expect(p, "OK", ECHO_TIMEOUT)) {
ast_log(LOG_WARNING, "Modem did not provide identification\n");
@@ -493,11 +493,11 @@ struct ast_channel *ast_modem_new(struct ast_modem_pvt *i, int state)
tmp->pvt->answer = modem_answer;
tmp->pvt->read = modem_read;
tmp->pvt->write = modem_write;
- strncpy(tmp->context, i->context, sizeof(tmp->context));
+ strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
if (strlen(i->cid))
tmp->callerid = strdup(i->cid);
if (strlen(i->language))
- strncpy(tmp->language,i->language, sizeof(tmp->language));
+ strncpy(tmp->language,i->language, sizeof(tmp->language)-1);
i->owner = tmp;
ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
@@ -677,9 +677,9 @@ static struct ast_modem_pvt *mkif(char *iface)
free(tmp);
return NULL;
}
- strncpy(tmp->language, language, sizeof(tmp->language));
- strncpy(tmp->msn, msn, sizeof(tmp->msn));
- strncpy(tmp->dev, iface, sizeof(tmp->dev));
+ strncpy(tmp->language, language, sizeof(tmp->language)-1);
+ strncpy(tmp->msn, msn, sizeof(tmp->msn)-1);
+ strncpy(tmp->dev, iface, sizeof(tmp->dev)-1);
/* Maybe in the future we want to allow variable
serial settings */
stty(tmp);
@@ -701,8 +701,8 @@ static struct ast_modem_pvt *mkif(char *iface)
tmp->dialtype = dialtype;
tmp->mode = gmode;
memset(tmp->cid, 0, sizeof(tmp->cid));
- strncpy(tmp->context, context, sizeof(tmp->context));
- strncpy(tmp->initstr, initstr, sizeof(tmp->initstr));
+ strncpy(tmp->context, context, sizeof(tmp->context)-1);
+ strncpy(tmp->initstr, initstr, sizeof(tmp->initstr)-1);
tmp->next = NULL;
tmp->obuflen = 0;
@@ -721,7 +721,7 @@ static struct ast_channel *modem_request(char *type, int format, void *data)
struct ast_modem_pvt *p;
struct ast_channel *tmp = NULL;
char dev[80];
- strncpy(dev, (char *)data, sizeof(dev));
+ strncpy(dev, (char *)data, sizeof(dev)-1);
strtok(dev, ":");
oldformat = format;
/* Search for an unowned channel */
@@ -811,17 +811,17 @@ int load_module()
} else if (!strcasecmp(v->name, "stripmsd")) {
stripmsd = atoi(v->value);
} else if (!strcasecmp(v->name, "type")) {
- strncpy(mtype, v->value, sizeof(mtype));
+ strncpy(mtype, v->value, sizeof(mtype)-1);
} else if (!strcasecmp(v->name, "initstr")) {
- strncpy(initstr, v->value, sizeof(initstr));
+ strncpy(initstr, v->value, sizeof(initstr)-1);
} else if (!strcasecmp(v->name, "dialtype")) {
dialtype = toupper(v->value[0]);
} else if (!strcasecmp(v->name, "context")) {
- strncpy(context, v->value, sizeof(context));
+ strncpy(context, v->value, sizeof(context)-1);
} else if (!strcasecmp(v->name, "msn")) {
- strncpy(msn, v->value, sizeof(msn));
+ strncpy(msn, v->value, sizeof(msn)-1);
} else if (!strcasecmp(v->name, "language")) {
- strncpy(language, v->value, sizeof(language));
+ strncpy(language, v->value, sizeof(language)-1);
}
v = v->next;
}
diff --git a/channels/chan_modem_aopen.c b/channels/chan_modem_aopen.c
index f93fe0b67..80a1402f9 100755
--- a/channels/chan_modem_aopen.c
+++ b/channels/chan_modem_aopen.c
@@ -54,7 +54,7 @@ static int aopen_setdev(struct ast_modem_pvt *p, int dev)
return -1;
}
ast_modem_trim(p->response);
- strncpy(cmd, p->response, sizeof(cmd));
+ strncpy(cmd, p->response, sizeof(cmd)-1);
if (ast_modem_expect(p, "OK", 5)) {
ast_log(LOG_WARNING, "Modem did not respond properly\n");
return -1;
@@ -344,17 +344,17 @@ static char *aopen_identify(struct ast_modem_pvt *p)
char rev[80];
ast_modem_send(p, "AT#MDL?", 0);
ast_modem_read_response(p, 5);
- strncpy(mdl, p->response, sizeof(mdl));
+ strncpy(mdl, p->response, sizeof(mdl)-1);
ast_modem_trim(mdl);
ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT#MFR?", 0);
ast_modem_read_response(p, 5);
- strncpy(mfr, p->response, sizeof(mfr));
+ strncpy(mfr, p->response, sizeof(mfr)-1);
ast_modem_trim(mfr);
ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT#REV?", 0);
ast_modem_read_response(p, 5);
- strncpy(rev, p->response, sizeof(rev));
+ strncpy(rev, p->response, sizeof(rev)-1);
ast_modem_trim(rev);
ast_modem_expect(p, "OK", 5);
snprintf(identity, sizeof(identity), "%s Model %s Revision %s", mfr, mdl, rev);
diff --git a/channels/chan_modem_bestdata.c b/channels/chan_modem_bestdata.c
index 59fbca11c..a360e32fd 100755
--- a/channels/chan_modem_bestdata.c
+++ b/channels/chan_modem_bestdata.c
@@ -189,7 +189,7 @@ static struct ast_frame *bestdata_handle_escape(struct ast_modem_pvt *p, char es
char res[1000];
if (ast_modem_read_response(p, 5)) break;
- strncpy(res, p->response, sizeof(res));
+ strncpy(res, p->response, sizeof(res)-1);
ast_modem_trim(res);
if (!strncmp(res,"\020.",2)) break;
if (!strncmp(res,"NAME",4)) strcpy(name,res + 7);
@@ -419,17 +419,17 @@ static char *bestdata_identify(struct ast_modem_pvt *p)
char rev[80];
ast_modem_send(p, "AT+FMM", 0);
ast_modem_read_response(p, 5);
- strncpy(mdl, p->response, sizeof(mdl));
+ strncpy(mdl, p->response, sizeof(mdl)-1);
ast_modem_trim(mdl);
ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT+FMI", 0);
ast_modem_read_response(p, 5);
- strncpy(mfr, p->response, sizeof(mfr));
+ strncpy(mfr, p->response, sizeof(mfr)-1);
ast_modem_trim(mfr);
ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT+FMR", 0);
ast_modem_read_response(p, 5);
- strncpy(rev, p->response, sizeof(rev));
+ strncpy(rev, p->response, sizeof(rev)-1);
ast_modem_trim(rev);
ast_modem_expect(p, "OK", 5);
snprintf(identity, sizeof(identity), "%s Model %s Revision %s", mfr, mdl, rev);
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index fab41ed14..3959cda13 100755
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -727,11 +727,11 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *p, int state)
tmp->pvt->indicate = oss_indicate;
tmp->pvt->fixup = oss_fixup;
if (strlen(p->context))
- strncpy(tmp->context, p->context, sizeof(tmp->context));
+ strncpy(tmp->context, p->context, sizeof(tmp->context)-1);
if (strlen(p->exten))
- strncpy(tmp->exten, p->exten, sizeof(tmp->exten));
+ strncpy(tmp->exten, p->exten, sizeof(tmp->exten)-1);
if (strlen(language))
- strncpy(tmp->language, language, sizeof(tmp->language));
+ strncpy(tmp->language, language, sizeof(tmp->language)-1);
p->owner = tmp;
tmp->state = state;
ast_pthread_mutex_lock(&usecnt_lock);
@@ -895,7 +895,7 @@ static int console_dial(int fd, int argc, char *argv[])
mye = exten;
myc = context;
if (argc == 2) {
- strncpy(tmp, argv[1], sizeof(tmp));
+ strncpy(tmp, argv[1], sizeof(tmp)-1);
strtok(tmp, "@");
tmp2 = strtok(NULL, "@");
if (strlen(tmp))
@@ -904,8 +904,8 @@ static int console_dial(int fd, int argc, char *argv[])
myc = tmp2;
}
if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
- strncpy(oss.exten, mye, sizeof(oss.exten));
- strncpy(oss.context, myc, sizeof(oss.context));
+ strncpy(oss.exten, mye, sizeof(oss.exten)-1);
+ strncpy(oss.context, myc, sizeof(oss.context)-1);
hookstate = 1;
oss_new(&oss, AST_STATE_UP);
} else
@@ -972,11 +972,11 @@ int load_module()
else if (!strcasecmp(v->name, "silencethreshold"))
silencethreshold = atoi(v->value);
else if (!strcasecmp(v->name, "context"))
- strncpy(context, v->value, sizeof(context));
+ strncpy(context, v->value, sizeof(context)-1);
else if (!strcasecmp(v->name, "language"))
- strncpy(language, v->value, sizeof(language));
+ strncpy(language, v->value, sizeof(language)-1);
else if (!strcasecmp(v->name, "extension"))
- strncpy(exten, v->value, sizeof(exten));
+ strncpy(exten, v->value, sizeof(exten)-1);
v=v->next;
}
ast_destroy(cfg);
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 27de1daac..c481abb99 100755
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -599,11 +599,11 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
tmp->pvt->read = phone_read;
tmp->pvt->write = phone_write;
tmp->pvt->exception = phone_exception;
- strncpy(tmp->context, context, sizeof(tmp->context));
+ strncpy(tmp->context, context, sizeof(tmp->context)-1);
if (strlen(i->ext))
- strncpy(tmp->exten, i->ext, sizeof(tmp->exten));
+ strncpy(tmp->exten, i->ext, sizeof(tmp->exten)-1);
if (strlen(i->language))
- strncpy(tmp->language, i->language, sizeof(tmp->language));
+ strncpy(tmp->language, i->language, sizeof(tmp->language)-1);
if (strlen(i->callerid))
tmp->callerid = strdup(i->callerid);
i->owner = tmp;
@@ -934,14 +934,14 @@ 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));
- strncpy(tmp->dev, iface, sizeof(tmp->dev));
- strncpy(tmp->context, context, sizeof(tmp->context));
+ strncpy(tmp->language, language, sizeof(tmp->language)-1);
+ strncpy(tmp->dev, iface, sizeof(tmp->dev)-1);
+ strncpy(tmp->context, context, sizeof(tmp->context)-1);
tmp->next = NULL;
tmp->obuflen = 0;
tmp->dialtone = 0;
tmp->cpt = 0;
- strncpy(tmp->callerid, callerid, sizeof(tmp->callerid));
+ strncpy(tmp->callerid, callerid, sizeof(tmp->callerid)-1);
tmp->txgain = txgain;
ioctl(tmp->fd, PHONE_PLAY_VOLUME, tmp->txgain);
tmp->rxgain = rxgain;
@@ -1044,9 +1044,9 @@ int load_module()
} else if (!strcasecmp(v->name, "silencesupression")) {
silencesupression = ast_true(v->value);
} else if (!strcasecmp(v->name, "language")) {
- strncpy(language, v->value, sizeof(language));
+ strncpy(language, v->value, sizeof(language)-1);
} else if (!strcasecmp(v->name, "callerid")) {
- strncpy(callerid, v->value, sizeof(callerid));
+ strncpy(callerid, v->value, sizeof(callerid)-1);
} else if (!strcasecmp(v->name, "mode")) {
if (!strncasecmp(v->value, "di", 2))
mode = MODE_DIALTONE;
@@ -1057,7 +1057,7 @@ int load_module()
else
ast_log(LOG_WARNING, "Unknown mode: %s\n", v->value);
} else if (!strcasecmp(v->name, "context")) {
- strncpy(context, v->value, sizeof(context));
+ strncpy(context, v->value, sizeof(context)-1);
} else if (!strcasecmp(v->name, "format")) {
if (!strcasecmp(v->value, "g723.1")) {
prefformat = AST_FORMAT_G723_1;
diff --git a/channels/chan_vofr.c b/channels/chan_vofr.c
index 836c1de34..00cb19bb3 100755
--- a/channels/chan_vofr.c
+++ b/channels/chan_vofr.c
@@ -823,13 +823,13 @@ static struct ast_channel *vofr_new(struct vofr_pvt *i, int state)
tmp->pvt->write = vofr_write;
tmp->pvt->fixup = vofr_fixup;
if (strlen(i->language))
- strncpy(tmp->language, i->language, sizeof(tmp->language));
+ strncpy(tmp->language, i->language, sizeof(tmp->language)-1);
i->owner = tmp;
ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
ast_pthread_mutex_unlock(&usecnt_lock);
ast_update_use_count();
- strncpy(tmp->context, i->context, sizeof(tmp->context));
+ strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
if (state != AST_STATE_DOWN) {
if (ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@@ -1050,7 +1050,7 @@ static struct vofr_pvt *mkif(char *type, char *iface)
#ifdef OLD_SANGOMA_API
/* Prepare sockaddr for binding */
memset(&tmp->sa, 0, sizeof(tmp->sa));
- strncpy(tmp->sa.spkt_device, iface, sizeof(tmp->sa.spkt_device));
+ strncpy(tmp->sa.spkt_device, iface, sizeof(tmp->sa.spkt_device)-1);
tmp->sa.spkt_protocol = htons(0x16);
tmp->sa.spkt_family = AF_PACKET;
if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct sockaddr))) {
@@ -1059,8 +1059,8 @@ static struct vofr_pvt *mkif(char *type, char *iface)
memset(&tmp->sa, 0, sizeof(tmp->sa));
tmp->sa.sll_family = AF_WANPIPE;
tmp->sa.sll_protocol = htons(ETH_P_IP);
- strncpy(tmp->sa.sll_device, iface, sizeof(tmp->sa.sll_device));
- strncpy(tmp->sa.sll_card, "wanpipe1", sizeof(tmp->sa.sll_card));
+ strncpy(tmp->sa.sll_device, iface, sizeof(tmp->sa.sll_device)-1);
+ strncpy(tmp->sa.sll_card, "wanpipe1", sizeof(tmp->sa.sll_card)-1);
tmp->sa.sll_ifindex = 0;
if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct wan_sockaddr_ll))) {
#endif
@@ -1088,8 +1088,8 @@ static struct vofr_pvt *mkif(char *type, char *iface)
tmp->dlcih = 0;
tmp->cid = 1;
tmp->ringgothangup = 0;
- strncpy(tmp->language, language, sizeof(tmp->language));
- strncpy(tmp->context, context, sizeof(tmp->context));
+ strncpy(tmp->language, language, sizeof(tmp->language)-1);
+ strncpy(tmp->context, context, sizeof(tmp->context)-1);
/* User terminations are game for outgoing connections */
if (!strcasecmp(type, "user"))
tmp->outgoing = 1;
@@ -1169,9 +1169,9 @@ int load_module()
return -1;
}
} else if (!strcasecmp(v->name, "context")) {
- strncpy(context, v->value, sizeof(context));
+ strncpy(context, v->value, sizeof(context)-1);
} else if (!strcasecmp(v->name, "language")) {
- strncpy(language, v->value, sizeof(language));
+ strncpy(language, v->value, sizeof(language)-1);
}
v = v->next;
}
diff --git a/cli.c b/cli.c
index e12871ad0..b747997c9 100755
--- a/cli.c
+++ b/cli.c
@@ -325,7 +325,7 @@ static char *complete_fn(char *line, char *word, int pos, int state)
if (pos != 1)
return NULL;
if (word[0] == '/')
- strncpy(filename, word, sizeof(filename));
+ strncpy(filename, word, sizeof(filename)-1);
else
snprintf(filename, sizeof(filename), "%s/%s", AST_MODULE_DIR, word);
c = (char*)filename_completion_function(filename, state);
diff --git a/file.c b/file.c
index 1753f45b8..6080f9966 100755
--- a/file.c
+++ b/file.c
@@ -96,8 +96,8 @@ int ast_format_register(char *name, char *exts, int format,
ast_pthread_mutex_unlock(&formatlock);
return -1;
}
- strncpy(tmp->name, name, sizeof(tmp->name));
- strncpy(tmp->exts, exts, sizeof(tmp->exts));
+ strncpy(tmp->name, name, sizeof(tmp->name)-1);
+ strncpy(tmp->exts, exts, sizeof(tmp->exts)-1);
tmp->open = open;
tmp->rewrite = rewrite;
tmp->apply = apply;
@@ -369,7 +369,7 @@ int ast_fileexists(char *filename, char *fmt, char *preflang)
snprintf(filename2, sizeof(filename2), "%s-%s", filename, preflang);
res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS);
if (res < 1) {
- strncpy(lang2, preflang, sizeof(lang2));
+ strncpy(lang2, preflang, sizeof(lang2)-1);
strtok(lang2, "_");
if (strcmp(lang2, preflang)) {
snprintf(filename2, sizeof(filename2), "%s-%s", filename, lang2);
@@ -422,13 +422,13 @@ int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang)
snprintf(filename2, sizeof(filename2), "%s-%s", filename, preflang);
fmts = ast_fileexists(filename2, NULL, NULL);
if (fmts < 1) {
- strncpy(lang2, preflang, sizeof(lang2));
+ strncpy(lang2, preflang, sizeof(lang2)-1);
snprintf(filename2, sizeof(filename2), "%s-%s", filename, lang2);
fmts = ast_fileexists(filename2, NULL, NULL);
}
}
if (fmts < 1) {
- strncpy(filename2, filename, sizeof(filename2));
+ strncpy(filename2, filename, sizeof(filename2)-1);
fmts = ast_fileexists(filename2, NULL, NULL);
}
if (fmts < 1) {
diff --git a/image.c b/image.c
index 61eefde13..33f49def3 100755
--- a/image.c
+++ b/image.c
@@ -114,7 +114,7 @@ struct ast_frame *ast_read_image(char *filename, char *preflang, int format)
i = list;
while(!found && i) {
if (i->format & format) {
- strncpy(tmp, i->exts, sizeof(tmp));
+ strncpy(tmp, i->exts, sizeof(tmp)-1);
e = strtok(tmp, "|");
while(e) {
make_filename(buf, sizeof(buf), filename, preflang, e);