mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 22:30:28 +00:00
fix various pointer signedness issues
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
14
dns.c
14
dns.c
@@ -91,7 +91,7 @@ struct dn_answer {
|
|||||||
unsigned short size;
|
unsigned short size;
|
||||||
} __attribute__ ((__packed__));
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
static int skip_name(char *s, int len)
|
static int skip_name(unsigned char *s, int len)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
@@ -116,10 +116,10 @@ static int skip_name(char *s, int len)
|
|||||||
|
|
||||||
/*! \brief Parse DNS lookup result, call callback */
|
/*! \brief Parse DNS lookup result, call callback */
|
||||||
static int dns_parse_answer(void *context,
|
static int dns_parse_answer(void *context,
|
||||||
int class, int type, char *answer, int len,
|
int class, int type, unsigned char *answer, int len,
|
||||||
int (*callback)(void *context, char *answer, int len, char *fullanswer))
|
int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer))
|
||||||
{
|
{
|
||||||
char *fullanswer = answer;
|
unsigned char *fullanswer = answer;
|
||||||
struct dn_answer *ans;
|
struct dn_answer *ans;
|
||||||
dns_HEADER *h;
|
dns_HEADER *h;
|
||||||
int res;
|
int res;
|
||||||
@@ -192,12 +192,12 @@ not work properly, Asterisk might not start properly or a channel may lock.
|
|||||||
*/
|
*/
|
||||||
int ast_search_dns(void *context,
|
int ast_search_dns(void *context,
|
||||||
const char *dname, int class, int type,
|
const char *dname, int class, int type,
|
||||||
int (*callback)(void *context, char *answer, int len, char *fullanswer))
|
int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer))
|
||||||
{
|
{
|
||||||
#ifdef HAS_RES_NINIT
|
#ifdef HAS_RES_NINIT
|
||||||
struct __res_state dnsstate;
|
struct __res_state dnsstate;
|
||||||
#endif
|
#endif
|
||||||
char answer[MAX_SIZE];
|
unsigned char answer[MAX_SIZE];
|
||||||
int res, ret = -1;
|
int res, ret = -1;
|
||||||
|
|
||||||
#ifdef HAS_RES_NINIT
|
#ifdef HAS_RES_NINIT
|
||||||
@@ -205,7 +205,7 @@ int ast_search_dns(void *context,
|
|||||||
memset(&dnsstate, 0, sizeof(dnsstate));
|
memset(&dnsstate, 0, sizeof(dnsstate));
|
||||||
#endif
|
#endif
|
||||||
res_ninit(&dnsstate);
|
res_ninit(&dnsstate);
|
||||||
res = res_nsearch(&dnsstate, dname, class, type, (unsigned char *)answer, sizeof(answer));
|
res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer));
|
||||||
#else
|
#else
|
||||||
ast_mutex_lock(&res_lock);
|
ast_mutex_lock(&res_lock);
|
||||||
res_init();
|
res_init();
|
||||||
|
|||||||
14
enum.c
14
enum.c
@@ -95,7 +95,7 @@ struct naptr {
|
|||||||
} __attribute__ ((__packed__));
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
/*! \brief Parse NAPTR record information elements */
|
/*! \brief Parse NAPTR record information elements */
|
||||||
static unsigned int parse_ie(char *data, unsigned int maxdatalen, char *src, unsigned int srclen)
|
static unsigned int parse_ie(char *data, unsigned int maxdatalen, unsigned char *src, unsigned int srclen)
|
||||||
{
|
{
|
||||||
unsigned int len, olen;
|
unsigned int len, olen;
|
||||||
|
|
||||||
@@ -116,10 +116,10 @@ static unsigned int parse_ie(char *data, unsigned int maxdatalen, char *src, uns
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Parse DNS NAPTR record used in ENUM ---*/
|
/*! \brief Parse DNS NAPTR record used in ENUM ---*/
|
||||||
static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, unsigned char *naptrinput)
|
static int parse_naptr(char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, char *naptrinput)
|
||||||
{
|
{
|
||||||
char tech_return[80];
|
char tech_return[80];
|
||||||
char *oanswer = answer;
|
unsigned char *oanswer = answer;
|
||||||
char flags[512] = "";
|
char flags[512] = "";
|
||||||
char services[512] = "";
|
char services[512] = "";
|
||||||
char *p;
|
char *p;
|
||||||
@@ -167,7 +167,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
|
|||||||
len -= res;
|
len -= res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = dn_expand((unsigned char *)oanswer, (unsigned char *)answer + len, (unsigned char *)answer, repl, sizeof(repl) - 1)) < 0) {
|
if ((res = dn_expand(oanswer, answer + len, answer, repl, sizeof(repl) - 1)) < 0) {
|
||||||
ast_log(LOG_WARNING, "Failed to expand hostname\n");
|
ast_log(LOG_WARNING, "Failed to expand hostname\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ struct enum_context {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Callback for TXT record lookup */
|
/*! \brief Callback for TXT record lookup */
|
||||||
static int txt_callback(void *context, char *answer, int len, char *fullanswer)
|
static int txt_callback(void *context, unsigned char *answer, int len, unsigned char *fullanswer)
|
||||||
{
|
{
|
||||||
struct enum_context *c = (struct enum_context *)context;
|
struct enum_context *c = (struct enum_context *)context;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -350,7 +350,7 @@ static int txt_callback(void *context, char *answer, int len, char *fullanswer)
|
|||||||
len +=1;
|
len +=1;
|
||||||
|
|
||||||
/* finally, copy the answer into c->txt */
|
/* finally, copy the answer into c->txt */
|
||||||
ast_copy_string(c->txt, answer, len < c->txtlen ? len : (c->txtlen));
|
ast_copy_string(c->txt, (const char *) answer, len < c->txtlen ? len : (c->txtlen));
|
||||||
|
|
||||||
/* just to be safe, let's make sure c->txt is null terminated */
|
/* just to be safe, let's make sure c->txt is null terminated */
|
||||||
c->txt[(c->txtlen)-1] = '\0';
|
c->txt[(c->txtlen)-1] = '\0';
|
||||||
@@ -359,7 +359,7 @@ static int txt_callback(void *context, char *answer, int len, char *fullanswer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Callback from ENUM lookup function */
|
/*! \brief Callback from ENUM lookup function */
|
||||||
static int enum_callback(void *context, char *answer, int len, char *fullanswer)
|
static int enum_callback(void *context, unsigned char *answer, int len, unsigned char *fullanswer)
|
||||||
{
|
{
|
||||||
struct enum_context *c = context;
|
struct enum_context *c = context;
|
||||||
void *p = NULL;
|
void *p = NULL;
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ struct ast_channel;
|
|||||||
services does not work, Asterisk may lock while waiting for response.
|
services does not work, Asterisk may lock while waiting for response.
|
||||||
*/
|
*/
|
||||||
int ast_search_dns(void *context, const char *dname, int class, int type,
|
int ast_search_dns(void *context, const char *dname, int class, int type,
|
||||||
int (*callback)(void *context, char *answer, int len, char *fullanswer));
|
int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer));
|
||||||
|
|
||||||
#endif /* _ASTERISK_DNS_H */
|
#endif /* _ASTERISK_DNS_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user