Version 0.1.10 from FTP

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Mark Spencer 24 years ago
parent 39b383b353
commit a07f2c930b

@ -89,7 +89,7 @@ static int record_exec(struct ast_channel *chan, void *data)
count++; count++;
} while ( ast_fileexists(tmp, ext, chan->language) != -1 ); } while ( ast_fileexists(tmp, ext, chan->language) != -1 );
} else } else
strncpy(tmp, fil, 256); strncpy(tmp, fil, 256-1);
/* end of routine mentioned */ /* end of routine mentioned */
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);

@ -55,7 +55,7 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n"); ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n");
return -1; return -1;
} }
strncpy(tmp, (char *)data, sizeof(tmp)); strncpy(tmp, (char *)data, sizeof(tmp)-1);
strtok(tmp, "|"); strtok(tmp, "|");
options = strtok(NULL, "|"); options = strtok(NULL, "|");
if (options && !strcasecmp(options, "wait")) if (options && !strcasecmp(options, "wait"))

@ -165,7 +165,7 @@ static int modem_call(struct ast_channel *ast, char *idest, int timeout)
struct ast_modem_pvt *p; struct ast_modem_pvt *p;
int ms = timeout; int ms = timeout;
char rdest[80], *where, dstr[100]; char rdest[80], *where, dstr[100];
strncpy(rdest, idest, sizeof(rdest)); strncpy(rdest, idest, sizeof(rdest)-1);
strtok(rdest, ":"); strtok(rdest, ":");
where = strtok(NULL, ":"); where = strtok(NULL, ":");
if (!where) { if (!where) {
@ -245,7 +245,7 @@ int ast_modem_read_response(struct ast_modem_pvt *p, int timeout)
do { do {
res = ast_waitfor_n_fd(&p->fd, 1, &timeout, NULL); res = ast_waitfor_n_fd(&p->fd, 1, &timeout, NULL);
if (res < 0) { if (res < 0) {
strncpy(p->response, "(No Response)", sizeof(p->response)); strncpy(p->response, "(No Response)", sizeof(p->response)-1);
return -1; return -1;
} }
/* get no more then buffer length */ /* 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 nothing in buffer, go back into timeout stuff */
if (errno == EWOULDBLOCK) break; if (errno == EWOULDBLOCK) break;
/* return as error */ /* return as error */
strncpy(p->response, "(No Response)", sizeof(p->response)); strncpy(p->response, "(No Response)", sizeof(p->response)-1);
return -1; return -1;
} }
/* save char */ /* save char */
@ -281,7 +281,7 @@ int ast_modem_read_response(struct ast_modem_pvt *p, int timeout)
} }
} }
} while(timeout > 0); } while(timeout > 0);
strncpy(p->response, "(No Response)", sizeof(p->response)); strncpy(p->response, "(No Response)", sizeof(p->response)-1);
return -1; return -1;
} }
@ -289,7 +289,7 @@ int ast_modem_expect(struct ast_modem_pvt *p, char *result, int timeout)
{ {
int res = -1; int res = -1;
timeout *= 1000; timeout *= 1000;
strncpy(p->response, "(No Response)", sizeof(p->response)); strncpy(p->response, "(No Response)", sizeof(p->response)-1);
do { do {
res = ast_waitfor_n_fd(&p->fd, 1, &timeout, NULL); res = ast_waitfor_n_fd(&p->fd, 1, &timeout, NULL);
if (res < 0) { 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"); ast_log(LOG_WARNING, "Modem did not provide identification\n");
return -1; return -1;
} }
strncpy(identity, p->response, sizeof(identity)); strncpy(identity, p->response, sizeof(identity)-1);
ast_modem_trim(identity); ast_modem_trim(identity);
if (ast_modem_expect(p, "OK", ECHO_TIMEOUT)) { if (ast_modem_expect(p, "OK", ECHO_TIMEOUT)) {
ast_log(LOG_WARNING, "Modem did not provide identification\n"); 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->answer = modem_answer;
tmp->pvt->read = modem_read; tmp->pvt->read = modem_read;
tmp->pvt->write = modem_write; 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)) if (strlen(i->cid))
tmp->callerid = strdup(i->cid); tmp->callerid = strdup(i->cid);
if (strlen(i->language)) if (strlen(i->language))
strncpy(tmp->language,i->language, sizeof(tmp->language)); strncpy(tmp->language,i->language, sizeof(tmp->language)-1);
i->owner = tmp; i->owner = tmp;
ast_pthread_mutex_lock(&usecnt_lock); ast_pthread_mutex_lock(&usecnt_lock);
usecnt++; usecnt++;
@ -677,9 +677,9 @@ static struct ast_modem_pvt *mkif(char *iface)
free(tmp); free(tmp);
return NULL; return NULL;
} }
strncpy(tmp->language, language, sizeof(tmp->language)); strncpy(tmp->language, language, sizeof(tmp->language)-1);
strncpy(tmp->msn, msn, sizeof(tmp->msn)); strncpy(tmp->msn, msn, sizeof(tmp->msn)-1);
strncpy(tmp->dev, iface, sizeof(tmp->dev)); strncpy(tmp->dev, iface, sizeof(tmp->dev)-1);
/* Maybe in the future we want to allow variable /* Maybe in the future we want to allow variable
serial settings */ serial settings */
stty(tmp); stty(tmp);
@ -701,8 +701,8 @@ static struct ast_modem_pvt *mkif(char *iface)
tmp->dialtype = dialtype; tmp->dialtype = dialtype;
tmp->mode = gmode; tmp->mode = gmode;
memset(tmp->cid, 0, sizeof(tmp->cid)); memset(tmp->cid, 0, sizeof(tmp->cid));
strncpy(tmp->context, context, sizeof(tmp->context)); strncpy(tmp->context, context, sizeof(tmp->context)-1);
strncpy(tmp->initstr, initstr, sizeof(tmp->initstr)); strncpy(tmp->initstr, initstr, sizeof(tmp->initstr)-1);
tmp->next = NULL; tmp->next = NULL;
tmp->obuflen = 0; 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_modem_pvt *p;
struct ast_channel *tmp = NULL; struct ast_channel *tmp = NULL;
char dev[80]; char dev[80];
strncpy(dev, (char *)data, sizeof(dev)); strncpy(dev, (char *)data, sizeof(dev)-1);
strtok(dev, ":"); strtok(dev, ":");
oldformat = format; oldformat = format;
/* Search for an unowned channel */ /* Search for an unowned channel */
@ -811,17 +811,17 @@ int load_module()
} else if (!strcasecmp(v->name, "stripmsd")) { } else if (!strcasecmp(v->name, "stripmsd")) {
stripmsd = atoi(v->value); stripmsd = atoi(v->value);
} else if (!strcasecmp(v->name, "type")) { } 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")) { } 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")) { } else if (!strcasecmp(v->name, "dialtype")) {
dialtype = toupper(v->value[0]); dialtype = toupper(v->value[0]);
} else if (!strcasecmp(v->name, "context")) { } 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")) { } 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")) { } else if (!strcasecmp(v->name, "language")) {
strncpy(language, v->value, sizeof(language)); strncpy(language, v->value, sizeof(language)-1);
} }
v = v->next; v = v->next;
} }

@ -54,7 +54,7 @@ static int aopen_setdev(struct ast_modem_pvt *p, int dev)
return -1; return -1;
} }
ast_modem_trim(p->response); 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)) { if (ast_modem_expect(p, "OK", 5)) {
ast_log(LOG_WARNING, "Modem did not respond properly\n"); ast_log(LOG_WARNING, "Modem did not respond properly\n");
return -1; return -1;
@ -344,17 +344,17 @@ static char *aopen_identify(struct ast_modem_pvt *p)
char rev[80]; char rev[80];
ast_modem_send(p, "AT#MDL?", 0); ast_modem_send(p, "AT#MDL?", 0);
ast_modem_read_response(p, 5); 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_trim(mdl);
ast_modem_expect(p, "OK", 5); ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT#MFR?", 0); ast_modem_send(p, "AT#MFR?", 0);
ast_modem_read_response(p, 5); 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_trim(mfr);
ast_modem_expect(p, "OK", 5); ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT#REV?", 0); ast_modem_send(p, "AT#REV?", 0);
ast_modem_read_response(p, 5); 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_trim(rev);
ast_modem_expect(p, "OK", 5); ast_modem_expect(p, "OK", 5);
snprintf(identity, sizeof(identity), "%s Model %s Revision %s", mfr, mdl, rev); snprintf(identity, sizeof(identity), "%s Model %s Revision %s", mfr, mdl, rev);

@ -189,7 +189,7 @@ static struct ast_frame *bestdata_handle_escape(struct ast_modem_pvt *p, char es
char res[1000]; char res[1000];
if (ast_modem_read_response(p, 5)) break; 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); ast_modem_trim(res);
if (!strncmp(res,"\020.",2)) break; if (!strncmp(res,"\020.",2)) break;
if (!strncmp(res,"NAME",4)) strcpy(name,res + 7); 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]; char rev[80];
ast_modem_send(p, "AT+FMM", 0); ast_modem_send(p, "AT+FMM", 0);
ast_modem_read_response(p, 5); 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_trim(mdl);
ast_modem_expect(p, "OK", 5); ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT+FMI", 0); ast_modem_send(p, "AT+FMI", 0);
ast_modem_read_response(p, 5); 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_trim(mfr);
ast_modem_expect(p, "OK", 5); ast_modem_expect(p, "OK", 5);
ast_modem_send(p, "AT+FMR", 0); ast_modem_send(p, "AT+FMR", 0);
ast_modem_read_response(p, 5); 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_trim(rev);
ast_modem_expect(p, "OK", 5); ast_modem_expect(p, "OK", 5);
snprintf(identity, sizeof(identity), "%s Model %s Revision %s", mfr, mdl, rev); snprintf(identity, sizeof(identity), "%s Model %s Revision %s", mfr, mdl, rev);

@ -727,11 +727,11 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *p, int state)
tmp->pvt->indicate = oss_indicate; tmp->pvt->indicate = oss_indicate;
tmp->pvt->fixup = oss_fixup; tmp->pvt->fixup = oss_fixup;
if (strlen(p->context)) 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)) if (strlen(p->exten))
strncpy(tmp->exten, p->exten, sizeof(tmp->exten)); strncpy(tmp->exten, p->exten, sizeof(tmp->exten)-1);
if (strlen(language)) if (strlen(language))
strncpy(tmp->language, language, sizeof(tmp->language)); strncpy(tmp->language, language, sizeof(tmp->language)-1);
p->owner = tmp; p->owner = tmp;
tmp->state = state; tmp->state = state;
ast_pthread_mutex_lock(&usecnt_lock); ast_pthread_mutex_lock(&usecnt_lock);
@ -895,7 +895,7 @@ static int console_dial(int fd, int argc, char *argv[])
mye = exten; mye = exten;
myc = context; myc = context;
if (argc == 2) { if (argc == 2) {
strncpy(tmp, argv[1], sizeof(tmp)); strncpy(tmp, argv[1], sizeof(tmp)-1);
strtok(tmp, "@"); strtok(tmp, "@");
tmp2 = strtok(NULL, "@"); tmp2 = strtok(NULL, "@");
if (strlen(tmp)) if (strlen(tmp))
@ -904,8 +904,8 @@ static int console_dial(int fd, int argc, char *argv[])
myc = tmp2; myc = tmp2;
} }
if (ast_exists_extension(NULL, myc, mye, 1, NULL)) { if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
strncpy(oss.exten, mye, sizeof(oss.exten)); strncpy(oss.exten, mye, sizeof(oss.exten)-1);
strncpy(oss.context, myc, sizeof(oss.context)); strncpy(oss.context, myc, sizeof(oss.context)-1);
hookstate = 1; hookstate = 1;
oss_new(&oss, AST_STATE_UP); oss_new(&oss, AST_STATE_UP);
} else } else
@ -972,11 +972,11 @@ int load_module()
else if (!strcasecmp(v->name, "silencethreshold")) else if (!strcasecmp(v->name, "silencethreshold"))
silencethreshold = atoi(v->value); silencethreshold = atoi(v->value);
else if (!strcasecmp(v->name, "context")) 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")) 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")) else if (!strcasecmp(v->name, "extension"))
strncpy(exten, v->value, sizeof(exten)); strncpy(exten, v->value, sizeof(exten)-1);
v=v->next; v=v->next;
} }
ast_destroy(cfg); ast_destroy(cfg);

@ -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->read = phone_read;
tmp->pvt->write = phone_write; tmp->pvt->write = phone_write;
tmp->pvt->exception = phone_exception; tmp->pvt->exception = phone_exception;
strncpy(tmp->context, context, sizeof(tmp->context)); strncpy(tmp->context, context, sizeof(tmp->context)-1);
if (strlen(i->ext)) 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)) 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)) if (strlen(i->callerid))
tmp->callerid = strdup(i->callerid); tmp->callerid = strdup(i->callerid);
i->owner = tmp; i->owner = tmp;
@ -934,14 +934,14 @@ static struct phone_pvt *mkif(char *iface, int mode, int txgain, int rxgain)
tmp->lastinput = -1; tmp->lastinput = -1;
tmp->ministate = 0; tmp->ministate = 0;
memset(tmp->ext, 0, sizeof(tmp->ext)); memset(tmp->ext, 0, sizeof(tmp->ext));
strncpy(tmp->language, language, sizeof(tmp->language)); strncpy(tmp->language, language, sizeof(tmp->language)-1);
strncpy(tmp->dev, iface, sizeof(tmp->dev)); strncpy(tmp->dev, iface, sizeof(tmp->dev)-1);
strncpy(tmp->context, context, sizeof(tmp->context)); strncpy(tmp->context, context, sizeof(tmp->context)-1);
tmp->next = NULL; tmp->next = NULL;
tmp->obuflen = 0; tmp->obuflen = 0;
tmp->dialtone = 0; tmp->dialtone = 0;
tmp->cpt = 0; tmp->cpt = 0;
strncpy(tmp->callerid, callerid, sizeof(tmp->callerid)); strncpy(tmp->callerid, callerid, sizeof(tmp->callerid)-1);
tmp->txgain = txgain; tmp->txgain = txgain;
ioctl(tmp->fd, PHONE_PLAY_VOLUME, tmp->txgain); ioctl(tmp->fd, PHONE_PLAY_VOLUME, tmp->txgain);
tmp->rxgain = rxgain; tmp->rxgain = rxgain;
@ -1044,9 +1044,9 @@ int load_module()
} else if (!strcasecmp(v->name, "silencesupression")) { } else if (!strcasecmp(v->name, "silencesupression")) {
silencesupression = ast_true(v->value); silencesupression = ast_true(v->value);
} else if (!strcasecmp(v->name, "language")) { } 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")) { } 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")) { } else if (!strcasecmp(v->name, "mode")) {
if (!strncasecmp(v->value, "di", 2)) if (!strncasecmp(v->value, "di", 2))
mode = MODE_DIALTONE; mode = MODE_DIALTONE;
@ -1057,7 +1057,7 @@ int load_module()
else else
ast_log(LOG_WARNING, "Unknown mode: %s\n", v->value); ast_log(LOG_WARNING, "Unknown mode: %s\n", v->value);
} else if (!strcasecmp(v->name, "context")) { } 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")) { } else if (!strcasecmp(v->name, "format")) {
if (!strcasecmp(v->value, "g723.1")) { if (!strcasecmp(v->value, "g723.1")) {
prefformat = AST_FORMAT_G723_1; prefformat = AST_FORMAT_G723_1;

@ -823,13 +823,13 @@ static struct ast_channel *vofr_new(struct vofr_pvt *i, int state)
tmp->pvt->write = vofr_write; tmp->pvt->write = vofr_write;
tmp->pvt->fixup = vofr_fixup; tmp->pvt->fixup = vofr_fixup;
if (strlen(i->language)) if (strlen(i->language))
strncpy(tmp->language, i->language, sizeof(tmp->language)); strncpy(tmp->language, i->language, sizeof(tmp->language)-1);
i->owner = tmp; i->owner = tmp;
ast_pthread_mutex_lock(&usecnt_lock); ast_pthread_mutex_lock(&usecnt_lock);
usecnt++; usecnt++;
ast_pthread_mutex_unlock(&usecnt_lock); ast_pthread_mutex_unlock(&usecnt_lock);
ast_update_use_count(); 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 (state != AST_STATE_DOWN) {
if (ast_pbx_start(tmp)) { if (ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name); 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 #ifdef OLD_SANGOMA_API
/* Prepare sockaddr for binding */ /* Prepare sockaddr for binding */
memset(&tmp->sa, 0, sizeof(tmp->sa)); 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_protocol = htons(0x16);
tmp->sa.spkt_family = AF_PACKET; tmp->sa.spkt_family = AF_PACKET;
if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct sockaddr))) { 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)); memset(&tmp->sa, 0, sizeof(tmp->sa));
tmp->sa.sll_family = AF_WANPIPE; tmp->sa.sll_family = AF_WANPIPE;
tmp->sa.sll_protocol = htons(ETH_P_IP); tmp->sa.sll_protocol = htons(ETH_P_IP);
strncpy(tmp->sa.sll_device, iface, sizeof(tmp->sa.sll_device)); strncpy(tmp->sa.sll_device, iface, sizeof(tmp->sa.sll_device)-1);
strncpy(tmp->sa.sll_card, "wanpipe1", sizeof(tmp->sa.sll_card)); strncpy(tmp->sa.sll_card, "wanpipe1", sizeof(tmp->sa.sll_card)-1);
tmp->sa.sll_ifindex = 0; tmp->sa.sll_ifindex = 0;
if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct wan_sockaddr_ll))) { if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct wan_sockaddr_ll))) {
#endif #endif
@ -1088,8 +1088,8 @@ static struct vofr_pvt *mkif(char *type, char *iface)
tmp->dlcih = 0; tmp->dlcih = 0;
tmp->cid = 1; tmp->cid = 1;
tmp->ringgothangup = 0; tmp->ringgothangup = 0;
strncpy(tmp->language, language, sizeof(tmp->language)); strncpy(tmp->language, language, sizeof(tmp->language)-1);
strncpy(tmp->context, context, sizeof(tmp->context)); strncpy(tmp->context, context, sizeof(tmp->context)-1);
/* User terminations are game for outgoing connections */ /* User terminations are game for outgoing connections */
if (!strcasecmp(type, "user")) if (!strcasecmp(type, "user"))
tmp->outgoing = 1; tmp->outgoing = 1;
@ -1169,9 +1169,9 @@ int load_module()
return -1; return -1;
} }
} else if (!strcasecmp(v->name, "context")) { } 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")) { } else if (!strcasecmp(v->name, "language")) {
strncpy(language, v->value, sizeof(language)); strncpy(language, v->value, sizeof(language)-1);
} }
v = v->next; v = v->next;
} }

@ -325,7 +325,7 @@ static char *complete_fn(char *line, char *word, int pos, int state)
if (pos != 1) if (pos != 1)
return NULL; return NULL;
if (word[0] == '/') if (word[0] == '/')
strncpy(filename, word, sizeof(filename)); strncpy(filename, word, sizeof(filename)-1);
else else
snprintf(filename, sizeof(filename), "%s/%s", AST_MODULE_DIR, word); snprintf(filename, sizeof(filename), "%s/%s", AST_MODULE_DIR, word);
c = (char*)filename_completion_function(filename, state); c = (char*)filename_completion_function(filename, state);

@ -96,8 +96,8 @@ int ast_format_register(char *name, char *exts, int format,
ast_pthread_mutex_unlock(&formatlock); ast_pthread_mutex_unlock(&formatlock);
return -1; return -1;
} }
strncpy(tmp->name, name, sizeof(tmp->name)); strncpy(tmp->name, name, sizeof(tmp->name)-1);
strncpy(tmp->exts, exts, sizeof(tmp->exts)); strncpy(tmp->exts, exts, sizeof(tmp->exts)-1);
tmp->open = open; tmp->open = open;
tmp->rewrite = rewrite; tmp->rewrite = rewrite;
tmp->apply = apply; tmp->apply = apply;
@ -369,7 +369,7 @@ int ast_fileexists(char *filename, char *fmt, char *preflang)
snprintf(filename2, sizeof(filename2), "%s-%s", filename, preflang); snprintf(filename2, sizeof(filename2), "%s-%s", filename, preflang);
res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS); res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS);
if (res < 1) { if (res < 1) {
strncpy(lang2, preflang, sizeof(lang2)); strncpy(lang2, preflang, sizeof(lang2)-1);
strtok(lang2, "_"); strtok(lang2, "_");
if (strcmp(lang2, preflang)) { if (strcmp(lang2, preflang)) {
snprintf(filename2, sizeof(filename2), "%s-%s", filename, lang2); 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); snprintf(filename2, sizeof(filename2), "%s-%s", filename, preflang);
fmts = ast_fileexists(filename2, NULL, NULL); fmts = ast_fileexists(filename2, NULL, NULL);
if (fmts < 1) { if (fmts < 1) {
strncpy(lang2, preflang, sizeof(lang2)); strncpy(lang2, preflang, sizeof(lang2)-1);
snprintf(filename2, sizeof(filename2), "%s-%s", filename, lang2); snprintf(filename2, sizeof(filename2), "%s-%s", filename, lang2);
fmts = ast_fileexists(filename2, NULL, NULL); fmts = ast_fileexists(filename2, NULL, NULL);
} }
} }
if (fmts < 1) { if (fmts < 1) {
strncpy(filename2, filename, sizeof(filename2)); strncpy(filename2, filename, sizeof(filename2)-1);
fmts = ast_fileexists(filename2, NULL, NULL); fmts = ast_fileexists(filename2, NULL, NULL);
} }
if (fmts < 1) { if (fmts < 1) {

@ -114,7 +114,7 @@ struct ast_frame *ast_read_image(char *filename, char *preflang, int format)
i = list; i = list;
while(!found && i) { while(!found && i) {
if (i->format & format) { if (i->format & format) {
strncpy(tmp, i->exts, sizeof(tmp)); strncpy(tmp, i->exts, sizeof(tmp)-1);
e = strtok(tmp, "|"); e = strtok(tmp, "|");
while(e) { while(e) {
make_filename(buf, sizeof(buf), filename, preflang, e); make_filename(buf, sizeof(buf), filename, preflang, e);

Loading…
Cancel
Save