Merged revisions 221777 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

................
  r221777 | tilghman | 2009-10-01 18:59:15 -0500 (Thu, 01 Oct 2009) | 9 lines
  
  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: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@221778 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2009-10-02 00:03:52 +00:00
parent a2be864b60
commit a37107aae6
3 changed files with 21 additions and 20 deletions

View File

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

View File

@@ -2024,7 +2024,7 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i
*/ */
void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt) void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt)
{ {
if (pt < 0 || pt > MAX_RTP_PT || static_RTP_PT[pt].code == 0) if (pt < 0 || pt >= MAX_RTP_PT || static_RTP_PT[pt].code == 0)
return; /* bogus payload type */ return; /* bogus payload type */
rtp_bridge_lock(rtp); rtp_bridge_lock(rtp);
@@ -2036,7 +2036,7 @@ void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt)
an unknown media type */ an unknown media type */
void ast_rtp_unset_m_type(struct ast_rtp* rtp, int pt) void ast_rtp_unset_m_type(struct ast_rtp* rtp, int pt)
{ {
if (pt < 0 || pt > MAX_RTP_PT) if (pt < 0 || pt >= MAX_RTP_PT)
return; /* bogus payload type */ return; /* bogus payload type */
rtp_bridge_lock(rtp); rtp_bridge_lock(rtp);
@@ -2056,7 +2056,7 @@ int ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt,
unsigned int i; unsigned int i;
int found = 0; int found = 0;
if (pt < 0 || pt > MAX_RTP_PT) if (pt < 0 || pt >= MAX_RTP_PT)
return -1; /* bogus payload type */ return -1; /* bogus payload type */
rtp_bridge_lock(rtp); rtp_bridge_lock(rtp);
@@ -2106,7 +2106,7 @@ struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt)
result.isAstFormat = result.code = 0; result.isAstFormat = result.code = 0;
if (pt < 0 || pt > MAX_RTP_PT) if (pt < 0 || pt >= MAX_RTP_PT)
return result; /* bogus payload type */ return result; /* bogus payload type */
/* Start with negotiated codecs */ /* Start with negotiated codecs */
@@ -3245,7 +3245,7 @@ struct ast_codec_pref *ast_rtp_codec_getpref(struct ast_rtp *rtp)
int ast_rtp_codec_getformat(int pt) int ast_rtp_codec_getformat(int pt)
{ {
if (pt < 0 || pt > MAX_RTP_PT) if (pt < 0 || pt >= MAX_RTP_PT)
return 0; /* bogus payload type */ return 0; /* bogus payload type */
if (static_RTP_PT[pt].isAstFormat) if (static_RTP_PT[pt].isAstFormat)

View File

@@ -3496,7 +3496,7 @@ int ast_say_date_with_format_en(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -3743,7 +3743,7 @@ int ast_say_date_with_format_da(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -3945,7 +3945,7 @@ int ast_say_date_with_format_de(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -4148,8 +4148,9 @@ int ast_say_date_with_format_th(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
}
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
break; break;
@@ -4342,7 +4343,7 @@ int ast_say_date_with_format_he(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -4482,7 +4483,7 @@ int ast_say_date_with_format_es(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile); snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
@@ -4671,7 +4672,7 @@ int ast_say_date_with_format_fr(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -4866,7 +4867,7 @@ int ast_say_date_with_format_it(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -5096,7 +5097,7 @@ int ast_say_date_with_format_nl(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -5299,7 +5300,7 @@ int ast_say_date_with_format_pl(struct ast_channel *chan, time_t thetime, const
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset = 0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -5518,7 +5519,7 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile); snprintf(nextmsg, sizeof(nextmsg), "%s", sndfile);
@@ -5810,7 +5811,7 @@ int ast_say_date_with_format_zh(struct ast_channel *chan, time_t time, const cha
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);
@@ -7299,7 +7300,7 @@ static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t time, co
case '\'': case '\'':
/* Literal name of a sound file */ /* Literal name of a sound file */
sndoffset=0; 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] = format[offset];
sndfile[sndoffset] = '\0'; sndfile[sndoffset] = '\0';
res = wait_file(chan, ints, sndfile, lang); res = wait_file(chan, ints, sndfile, lang);