dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 221776 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r221776 | tilghman | 2009-10-01 18:53:12 -0500 (Thu, 01 Oct 2009) | 2 lines
  
  Fix a bunch of off-by-one errors
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@221777 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
tilghman 2009-10-01 23:59:15 +00:00
parent 877387c559
commit 5081871fa4
3 changed files with 18 additions and 18 deletions

View File

@ -1218,7 +1218,7 @@ static void *netconsole(void *vconsole)
continue;
}
if (fds[0].revents) {
res = read_credentials(con->fd, tmp, sizeof(tmp), con);
res = read_credentials(con->fd, tmp, sizeof(tmp) - 1, con);
if (res < 1) {
break;
}
@ -2418,7 +2418,7 @@ static char *cli_complete(EditLine *editline, int ch)
if (ast_opt_remote) {
snprintf(buf, sizeof(buf), "_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
fdsend(ast_consock, buf);
res = read(ast_consock, buf, sizeof(buf));
res = read(ast_consock, buf, sizeof(buf) - 1);
buf[res] = '\0';
nummatches = atoi(buf);

View File

@ -499,7 +499,7 @@ void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_cod
void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
{
if (payload < 0 || payload > AST_RTP_MAX_PT || !static_RTP_PT[payload].code) {
if (payload < 0 || payload >= AST_RTP_MAX_PT || !static_RTP_PT[payload].code) {
return;
}
@ -521,7 +521,7 @@ int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs,
unsigned int i;
int found = 0;
if (pt < 0 || pt > AST_RTP_MAX_PT)
if (pt < 0 || pt >= AST_RTP_MAX_PT)
return -1; /* bogus payload type */
for (i = 0; i < ARRAY_LEN(ast_rtp_mime_types); ++i) {
@ -569,7 +569,7 @@ int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struc
void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
{
if (payload < 0 || payload > AST_RTP_MAX_PT) {
if (payload < 0 || payload >= AST_RTP_MAX_PT) {
return;
}
@ -587,7 +587,7 @@ struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs
{
struct ast_rtp_payload_type result = { .asterisk_format = 0, };
if (payload < 0 || payload > AST_RTP_MAX_PT) {
if (payload < 0 || payload >= AST_RTP_MAX_PT) {
return result;
}

View File

@ -3560,7 +3560,7 @@ int ast_say_date_with_format_en(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -3807,7 +3807,7 @@ int ast_say_date_with_format_da(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -4009,7 +4009,7 @@ int ast_say_date_with_format_de(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -4406,7 +4406,7 @@ int ast_say_date_with_format_he(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -4546,7 +4546,7 @@ int ast_say_date_with_format_es(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
@ -4735,7 +4735,7 @@ int ast_say_date_with_format_fr(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -4930,7 +4930,7 @@ int ast_say_date_with_format_it(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -5160,7 +5160,7 @@ int ast_say_date_with_format_nl(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -5363,7 +5363,7 @@ int ast_say_date_with_format_pl(struct ast_channel *chan, time_t thetime, const
case '\'':
/* Literal name of a sound file */
sndoffset = 0;
for (sndoffset = 0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset = 0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -5582,7 +5582,7 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
@ -5874,7 +5874,7 @@ int ast_say_date_with_format_zh(struct ast_channel *chan, time_t t, const char *
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);
@ -7363,7 +7363,7 @@ static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t t, const
case '\'':
/* Literal name of a sound file */
sndoffset=0;
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < 256) ; sndoffset++)
for (sndoffset=0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++)
sndfile[sndoffset] = format[offset];
sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang);