summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_voicemail.c3
-rw-r--r--autoconf/ast_ext_lib.m42
-rw-r--r--autoconf/ast_prog_ld.m42
-rwxr-xr-xconfigure10
-rw-r--r--configure.ac2
-rw-r--r--main/ast_expr2.c9
-rw-r--r--main/ast_expr2.y9
-rw-r--r--main/say.c4
-rw-r--r--res/ael/pval.c70
-rw-r--r--res/res_phoneprov.c5
-rw-r--r--res/res_pjsip_messaging.c18
-rw-r--r--res/res_pjsip_sdp_rtp.c2
12 files changed, 102 insertions, 34 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 586086c55..6607f529e 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3263,7 +3263,8 @@ void mm_lsub(MAILSTREAM * stream, int delim, char *mailbox, long attributes)
void mm_status(MAILSTREAM * stream, char *mailbox, MAILSTATUS * status)
{
struct ast_str *str;
- if (!DEBUG_ATLEAST(5) || !(str = ast_str_create(MAX_OBJECT_FIELD))) {
+
+ if (!DEBUG_ATLEAST(5) || !(str = ast_str_create(256))) {
return;
}
diff --git a/autoconf/ast_ext_lib.m4 b/autoconf/ast_ext_lib.m4
index 8f35f4bad..2c73b40c5 100644
--- a/autoconf/ast_ext_lib.m4
+++ b/autoconf/ast_ext_lib.m4
@@ -11,7 +11,7 @@ AC_DEFUN([AST_EXT_LIB_SETUP],
$1_DESCRIP="$2"
$1_OPTION="$3"
PBX_$1=0
- AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH$4]),
+ AC_ARG_WITH([$3], AS_HELP_STRING([--with-$3=PATH],[use $2 files in PATH$4]),
[
case ${withval} in
n|no)
diff --git a/autoconf/ast_prog_ld.m4 b/autoconf/ast_prog_ld.m4
index 9177fedb3..b69c2c2ac 100644
--- a/autoconf/ast_prog_ld.m4
+++ b/autoconf/ast_prog_ld.m4
@@ -3,7 +3,7 @@
# find the pathname to the GNU or non-GNU linker
AC_DEFUN([AST_PROG_LD],
[AC_ARG_WITH([gnu-ld],
- [AC_HELP_STRING([--with-gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
[assume the C compiler uses GNU ld @<:@default=no@:>@])],
[test "$withval" = no || with_gnu_ld=yes],
[with_gnu_ld=no])
diff --git a/configure b/configure
index bcc427c84..04183b401 100755
--- a/configure
+++ b/configure
@@ -13775,7 +13775,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -13821,7 +13821,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -13845,7 +13845,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -13890,7 +13890,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -13914,7 +13914,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
diff --git a/configure.ac b/configure.ac
index 3cc8588fe..2c47dc453 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1234,7 +1234,7 @@ AC_SUBST(AST_NATIVE_ARCH)
dnl Check to see if rpath should be set in LDFLAGS
AC_ARG_ENABLE(rpath,
- [AC_HELP_STRING([--disable-rpath],
+ [AS_HELP_STRING([--disable-rpath],
[Disables rpath linker option checking])],
[case "${enableval}" in
y|ye|yes) check_rpath=yes ;;
diff --git a/main/ast_expr2.c b/main/ast_expr2.c
index c700b01d7..b914598ec 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -3669,13 +3669,20 @@ op_tildetilde (struct val *a, struct val *b)
/* strip double quotes from both -- */
strip_quotes(a);
strip_quotes(b);
-
+
vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1);
+ if (vs == NULL) {
+ ast_log(LOG_WARNING, "malloc() failed\n");
+ return NULL;
+ }
+
strcpy(vs,a->u.s);
strcat(vs,b->u.s);
v = make_str(vs);
+ free(vs);
+
/* free arguments */
free_value(a);
free_value(b);
diff --git a/main/ast_expr2.y b/main/ast_expr2.y
index df87bcc7f..29fee35cf 100644
--- a/main/ast_expr2.y
+++ b/main/ast_expr2.y
@@ -1662,13 +1662,20 @@ op_tildetilde (struct val *a, struct val *b)
/* strip double quotes from both -- */
strip_quotes(a);
strip_quotes(b);
-
+
vs = malloc(strlen(a->u.s)+strlen(b->u.s)+1);
+ if (vs == NULL) {
+ ast_log(LOG_WARNING, "malloc() failed\n");
+ return NULL;
+ }
+
strcpy(vs,a->u.s);
strcat(vs,b->u.s);
v = make_str(vs);
+ free(vs);
+
/* free arguments */
free_value(a);
free_value(b);
diff --git a/main/say.c b/main/say.c
index 6e51de201..e4e374329 100644
--- a/main/say.c
+++ b/main/say.c
@@ -8521,9 +8521,9 @@ int ast_say_date_with_format_ja(struct ast_channel *chan, time_t time, const cha
/* NOTE: if you add more options here, please try to be consistent with strftime(3) */
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);
break;
diff --git a/res/ael/pval.c b/res/ael/pval.c
index d5ea5accf..ce9458c06 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -3356,9 +3356,9 @@ static int gen_prios(struct ael_extension *exten, char *label, pval *statement,
#ifdef OLD_RAND_ACTION
struct ael_priority *rand_test, *rand_end, *rand_skip;
#endif
- char *buf1;
- char *buf2;
- char *new_label;
+ RAII_VAR(char *, buf1, NULL, free);
+ RAII_VAR(char *, buf2, NULL, free);
+ RAII_VAR(char *, new_label, NULL, free);
char *strp, *strp2;
int default_exists;
int local_control_statement_count;
@@ -4192,9 +4192,6 @@ static int gen_prios(struct ael_extension *exten, char *label, pval *statement,
break;
}
}
- free(buf1);
- free(buf2);
- free(new_label);
return 0;
}
@@ -5053,7 +5050,10 @@ int pvalCheckType( pval *p, char *funcname, pvaltype type )
pval *pvalCreateNode( pvaltype type )
{
pval *p = calloc(1,sizeof(pval)); /* why, oh why, don't I use ast_calloc? Way, way, way too messy if I do! */
- p->type = type; /* remember, this can be used externally or internally to asterisk */
+ /* remember, this can be used externally or internally to asterisk */
+ if (p) {
+ p->type = type;
+ }
return p;
}
@@ -5414,14 +5414,30 @@ void pvalIncludesAddInclude( pval *p, const char *include )
void pvalIncludesAddIncludeWithTimeConstraints( pval *p, const char *include, char *hour_range, char *dom_range, char *dow_range, char *month_range )
{
- pval *hr = pvalCreateNode(PV_WORD);
- pval *dom = pvalCreateNode(PV_WORD);
- pval *dow = pvalCreateNode(PV_WORD);
- pval *mon = pvalCreateNode(PV_WORD);
- pval *s = pvalCreateNode(PV_WORD);
-
- if (!pvalCheckType(p, "pvalIncludeAddIncludeWithTimeConstraints", PV_INCLUDES))
+ pval *hr;
+ pval *dom;
+ pval *dow;
+ pval *mon;
+ pval *s;
+
+ if (!pvalCheckType(p, "pvalIncludeAddIncludeWithTimeConstraints", PV_INCLUDES)) {
+ return;
+ }
+
+ hr = pvalCreateNode(PV_WORD);
+ dom = pvalCreateNode(PV_WORD);
+ dow = pvalCreateNode(PV_WORD);
+ mon = pvalCreateNode(PV_WORD);
+ s = pvalCreateNode(PV_WORD);
+
+ if (!hr || !dom || !dow || !mon || !s) {
+ destroy_pval(hr);
+ destroy_pval(dom);
+ destroy_pval(dow);
+ destroy_pval(mon);
+ destroy_pval(s);
return;
+ }
s->u1.str = (char *)include;
p->u1.list = linku1(p->u1.list, s);
@@ -5668,12 +5684,28 @@ char* pvalIfGetCondition( pval *p )
void pvalIfTimeSetCondition( pval *p, char *hour_range, char *dow_range, char *dom_range, char *mon_range ) /* time range format: 24-hour format begin-end|dow range|dom range|month range */
{
- pval *hr = pvalCreateNode(PV_WORD);
- pval *dow = pvalCreateNode(PV_WORD);
- pval *dom = pvalCreateNode(PV_WORD);
- pval *mon = pvalCreateNode(PV_WORD);
- if (!pvalCheckType(p, "pvalIfTimeSetCondition", PV_IFTIME))
+ pval *hr;
+ pval *dow;
+ pval *dom;
+ pval *mon;
+
+ if (!pvalCheckType(p, "pvalIfTimeSetCondition", PV_IFTIME)) {
return;
+ }
+
+ hr = pvalCreateNode(PV_WORD);
+ dow = pvalCreateNode(PV_WORD);
+ dom = pvalCreateNode(PV_WORD);
+ mon = pvalCreateNode(PV_WORD);
+
+ if (!hr || !dom || !dow || !mon) {
+ destroy_pval(hr);
+ destroy_pval(dom);
+ destroy_pval(dow);
+ destroy_pval(mon);
+ return;
+ }
+
pvalWordSetString(hr, hour_range);
pvalWordSetString(dow, dow_range);
pvalWordSetString(dom, dom_range);
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index b448c8e0b..2e4f87362 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -410,10 +410,13 @@ static int load_file(const char *filename, char **ret)
fseek(f, 0, SEEK_END);
len = ftell(f);
fseek(f, 0, SEEK_SET);
- if (!(*ret = ast_malloc(len + 1)))
+ if (!(*ret = ast_malloc(len + 1))) {
+ fclose(f);
return -2;
+ }
if (len != fread(*ret, sizeof(char), len, f)) {
+ fclose(f);
ast_free(*ret);
*ret = NULL;
return -3;
diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index f72f3f015..b508a2a59 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -476,6 +476,24 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as
field = pj_sockaddr_print(&rdata->pkt_info.src_addr, buf, sizeof(buf) - 1, 1);
res |= ast_msg_set_var(msg, "PJSIP_RECVADDR", field);
+ switch (rdata->tp_info.transport->key.type) {
+ case PJSIP_TRANSPORT_UDP:
+ case PJSIP_TRANSPORT_UDP6:
+ field = "udp";
+ break;
+ case PJSIP_TRANSPORT_TCP:
+ case PJSIP_TRANSPORT_TCP6:
+ field = "tcp";
+ break;
+ case PJSIP_TRANSPORT_TLS:
+ case PJSIP_TRANSPORT_TLS6:
+ field = "tls";
+ break;
+ default:
+ field = rdata->tp_info.transport->type_name;
+ }
+ ast_msg_set_var(msg, "PJSIP_TRANSPORT", field);
+
if (print_body(rdata, buf, sizeof(buf) - 1) > 0) {
res |= ast_msg_set_body(msg, "%s", buf);
}
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 08e80a38c..048209ce1 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -429,7 +429,7 @@ static pjmedia_sdp_attr* generate_fmtp_attr(pj_pool_t *pool, struct ast_format *
*++tmp = '\0';
/* ast...generate gives us everything, just need value */
tmp = strchr(ast_str_buffer(fmtp0), ':');
- if (tmp && tmp + 1) {
+ if (tmp && tmp[1] != '\0') {
fmtp1 = pj_str(tmp + 1);
} else {
fmtp1 = pj_str(ast_str_buffer(fmtp0));