summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_minivm.c2
-rw-r--r--include/asterisk/iostream.h3
-rw-r--r--main/iostream.c2
-rw-r--r--res/res_pjsip/pjsip_configuration.c2
-rw-r--r--res/res_pjsip_endpoint_identifier_anonymous.c6
-rw-r--r--res/res_pjsip_endpoint_identifier_user.c12
-rw-r--r--res/snmp/agent.c4
-rw-r--r--tests/test_logger.c4
-rw-r--r--tests/test_pbx.c2
9 files changed, 26 insertions, 11 deletions
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index 0d7a5f407..8f920e09f 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -1252,7 +1252,7 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
struct ast_channel *chan = NULL;
char *fromaddress;
char *fromemail;
- int res;
+ int res = -1;
if (!str1 || !str2) {
return -1;
diff --git a/include/asterisk/iostream.h b/include/asterisk/iostream.h
index c641ffb37..e9816ac9b 100644
--- a/include/asterisk/iostream.h
+++ b/include/asterisk/iostream.h
@@ -109,7 +109,8 @@ ssize_t ast_iostream_read(struct ast_iostream *stream, void *buf, size_t count);
ssize_t ast_iostream_gets(struct ast_iostream *stream, char *buf, size_t count);
ssize_t ast_iostream_discard(struct ast_iostream *stream, size_t count);
ssize_t ast_iostream_write(struct ast_iostream *stream, const void *buf, size_t count);
-ssize_t ast_iostream_printf(struct ast_iostream *stream, const void *fmt, ...);
+ssize_t __attribute__((format(printf, 2, 3))) ast_iostream_printf(
+ struct ast_iostream *stream, const char *fmt, ...);
struct ast_iostream* ast_iostream_from_fd(int *fd);
int ast_iostream_start_tls(struct ast_iostream **stream, SSL_CTX *ctx, int client);
diff --git a/main/iostream.c b/main/iostream.c
index 2a2601d38..d91863319 100644
--- a/main/iostream.c
+++ b/main/iostream.c
@@ -443,7 +443,7 @@ ssize_t ast_iostream_write(struct ast_iostream *stream, const void *buf, size_t
}
}
-ssize_t ast_iostream_printf(struct ast_iostream *stream, const void *fmt, ...)
+ssize_t ast_iostream_printf(struct ast_iostream *stream, const char *fmt, ...)
{
char sbuf[512], *buf = sbuf;
int len, len2, ret = -1;
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 168d86989..e63e158c4 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -366,7 +366,7 @@ static int contact_acl_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtmf_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_endpoint *endpoint = obj;
- enum ast_sip_dtmf_mode dtmf = ast_sip_str_to_dtmf(var->value);
+ int dtmf = ast_sip_str_to_dtmf(var->value);
if (dtmf == -1) {
return -1;
diff --git a/res/res_pjsip_endpoint_identifier_anonymous.c b/res/res_pjsip_endpoint_identifier_anonymous.c
index a52946632..a1144a88e 100644
--- a/res/res_pjsip_endpoint_identifier_anonymous.c
+++ b/res/res_pjsip_endpoint_identifier_anonymous.c
@@ -56,9 +56,11 @@ static int find_transport_state_in_use(void *obj, void *arg, int flags)
return 0;
}
+#define DOMAIN_NAME_LEN 255
+
static struct ast_sip_endpoint *anonymous_identify(pjsip_rx_data *rdata)
{
- char domain_name[64], id[AST_UUID_STR_LEN];
+ char domain_name[DOMAIN_NAME_LEN + 1];
struct ast_sip_endpoint *endpoint;
RAII_VAR(struct ast_sip_domain_alias *, alias, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, transport_states, NULL, ao2_cleanup);
@@ -70,6 +72,8 @@ static struct ast_sip_endpoint *anonymous_identify(pjsip_rx_data *rdata)
}
if (!ast_sip_get_disable_multi_domain()) {
+ char id[sizeof("anonymous@") + DOMAIN_NAME_LEN];
+
/* Attempt to find the endpoint given the name and domain provided */
snprintf(id, sizeof(id), "anonymous@%s", domain_name);
if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) {
diff --git a/res/res_pjsip_endpoint_identifier_user.c b/res/res_pjsip_endpoint_identifier_user.c
index 369cb62fc..ff97a62e4 100644
--- a/res/res_pjsip_endpoint_identifier_user.c
+++ b/res/res_pjsip_endpoint_identifier_user.c
@@ -74,10 +74,12 @@ static int find_transport_state_in_use(void *obj, void *arg, int flags)
return 0;
}
+#define DOMAIN_NAME_LEN 255
+#define USERNAME_LEN 255
+
static struct ast_sip_endpoint *find_endpoint(pjsip_rx_data *rdata, char *endpoint_name,
char *domain_name)
{
- char id[AST_UUID_STR_LEN];
struct ast_sip_endpoint *endpoint;
RAII_VAR(struct ast_sip_domain_alias *, alias, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, transport_states, NULL, ao2_cleanup);
@@ -85,6 +87,8 @@ static struct ast_sip_endpoint *find_endpoint(pjsip_rx_data *rdata, char *endpoi
RAII_VAR(struct ast_sip_transport *, transport, NULL, ao2_cleanup);
if (!ast_sip_get_disable_multi_domain()) {
+ char id[DOMAIN_NAME_LEN + USERNAME_LEN + sizeof("@")];
+
/* Attempt to find the endpoint given the name and domain provided */
snprintf(id, sizeof(id), "%s@%s", endpoint_name, domain_name);
if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) {
@@ -116,8 +120,8 @@ static struct ast_sip_endpoint *find_endpoint(pjsip_rx_data *rdata, char *endpoi
static struct ast_sip_endpoint *username_identify(pjsip_rx_data *rdata)
{
- char username[64];
- char domain[64];
+ char username[USERNAME_LEN + 1];
+ char domain[DOMAIN_NAME_LEN + 1];
struct ast_sip_endpoint *endpoint;
if (get_from_header(rdata, username, sizeof(username), domain, sizeof(domain))) {
@@ -149,7 +153,7 @@ static struct ast_sip_endpoint *username_identify(pjsip_rx_data *rdata)
static struct ast_sip_endpoint *auth_username_identify(pjsip_rx_data *rdata)
{
- char username[64], realm[64];
+ char username[USERNAME_LEN + 1], realm[DOMAIN_NAME_LEN + 1];
struct ast_sip_endpoint *endpoint;
pjsip_authorization_hdr *auth_header = NULL;
diff --git a/res/snmp/agent.c b/res/snmp/agent.c
index 7ff78d56e..b8fcb07f6 100644
--- a/res/snmp/agent.c
+++ b/res/snmp/agent.c
@@ -63,6 +63,10 @@
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
+#if !defined(RONLY) && defined(NETSNMP_OLDAPI_RONLY)
+#define RONLY NETSNMP_OLDAPI_RONLY
+#endif
+
#include "asterisk/paths.h" /* need ast_config_AST_SOCKET */
#include "asterisk/channel.h"
#include "asterisk/logger.h"
diff --git a/tests/test_logger.c b/tests/test_logger.c
index 59ee3e6c1..6cbddb9c0 100644
--- a/tests/test_logger.c
+++ b/tests/test_logger.c
@@ -190,7 +190,7 @@ static char *handle_cli_performance_test(struct ast_cli_entry *e, int cmd, struc
static char *handle_cli_queue_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- unsigned int level;
+ int level;
int current_queue_limit;
unsigned int x;
struct timeval start, end;
@@ -220,7 +220,7 @@ static char *handle_cli_queue_test(struct ast_cli_entry *e, int cmd, struct ast_
ast_cli(a->fd, "Test: Failed, could not register level 'queuetest'.\n");
return CLI_SUCCESS;
}
- ast_cli(a->fd, "Test: got level %u for 'queuetest'.\n", level);
+ ast_cli(a->fd, "Test: got level %d for 'queuetest'.\n", level);
if (ast_logger_create_channel(tmppath, "queuetest") != AST_LOGGER_SUCCESS) {
ast_cli(a->fd, "Test: Unable to create logger channel '%s'\n", tmppath);
diff --git a/tests/test_pbx.c b/tests/test_pbx.c
index 00fa41130..155bec9bf 100644
--- a/tests/test_pbx.c
+++ b/tests/test_pbx.c
@@ -37,6 +37,8 @@
#include "asterisk/pbx.h"
#include "asterisk/test.h"
+#include <signal.h>
+
/*!
* If we determine that we really need
* to be able to register more than 10