aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/asterisk.c4
-rw-r--r--main/rtp.c10
-rw-r--r--main/say.c26
3 files changed, 20 insertions, 20 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index a6f0e57f6..83b851ebb 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1220,7 +1220,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;
}
@@ -2420,7 +2420,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);
diff --git a/main/rtp.c b/main/rtp.c
index 8b96a7a66..b81f8e01c 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -2241,7 +2241,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)
{
- 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 */
rtp_bridge_lock(rtp);
@@ -2253,7 +2253,7 @@ void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt)
an unknown media type */
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 */
rtp_bridge_lock(rtp);
@@ -2274,7 +2274,7 @@ int ast_rtp_set_rtpmap_type_rate(struct ast_rtp *rtp, int pt,
unsigned int i;
int found = 0;
- if (pt < 0 || pt > MAX_RTP_PT)
+ if (pt < 0 || pt >= MAX_RTP_PT)
return -1; /* bogus payload type */
rtp_bridge_lock(rtp);
@@ -2349,7 +2349,7 @@ struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt)
result.isAstFormat = result.code = 0;
- if (pt < 0 || pt > MAX_RTP_PT)
+ if (pt < 0 || pt >= MAX_RTP_PT)
return result; /* bogus payload type */
/* Start with negotiated codecs */
@@ -3786,7 +3786,7 @@ struct ast_codec_pref *ast_rtp_codec_getpref(struct ast_rtp *rtp)
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 */
if (static_RTP_PT[pt].isAstFormat)
diff --git a/main/say.c b/main/say.c
index c70e91418..f284f4a83 100644
--- a/main/say.c
+++ b/main/say.c
@@ -3496,7 +3496,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);
@@ -3743,7 +3743,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);
@@ -3945,7 +3945,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);
@@ -4148,7 +4148,7 @@ int ast_say_date_with_format_th(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);
@@ -4342,7 +4342,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);
@@ -4482,7 +4482,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);
@@ -4671,7 +4671,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);
@@ -4866,7 +4866,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);
@@ -5096,7 +5096,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);
@@ -5299,7 +5299,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);
@@ -5518,7 +5518,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);
@@ -5810,7 +5810,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);
@@ -7299,7 +7299,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);