summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-11-19 17:22:29 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-11-19 17:22:29 +0000
commita7c9f4c668c3b5d42f98d06ab0c20d81bd5fd25e (patch)
tree78fc178143752b565888ea2d16d7c60591d42884 /channels
parent7f8b7ace724e8c67e161763b721afbb605166f0e (diff)
ast_str: Fix improper member access to struct ast_str members.
Accessing members of struct ast_str outside of the string manipulation API routines is invalid since struct ast_str is supposed to be treated as opaque. Review: https://reviewboard.asterisk.org/r/4194/ ........ Merged revisions 428244 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 428245 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428246 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c18
-rw-r--r--channels/sip/security_events.c2
2 files changed, 10 insertions, 10 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ef074a398..192956362 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -9589,7 +9589,7 @@ static unsigned int set_pvt_allowed_methods(struct sip_pvt *pvt, struct sip_requ
This is enabled if pedanticsipchecking is enabled */
static void lws2sws(struct ast_str *data)
{
- char *msgbuf = data->str;
+ char *msgbuf = ast_str_buffer(data);
int len = ast_str_strlen(data);
int h = 0, t = 0;
int lws = 0;
@@ -9630,7 +9630,7 @@ static void lws2sws(struct ast_str *data)
lws = 0;
}
msgbuf[t] = '\0';
- data->used = t;
+ ast_str_update(data);
}
/*! \brief Parse a SIP message
@@ -9638,7 +9638,7 @@ static void lws2sws(struct ast_str *data)
*/
static int parse_request(struct sip_request *req)
{
- char *c = req->data->str;
+ char *c = ast_str_buffer(req->data);
ptrdiff_t *dst = req->header;
int i = 0, lim = SIP_MAX_HEADERS - 1;
unsigned int skipping_headers = 0;
@@ -13715,12 +13715,12 @@ static int transmit_response_with_sdp(struct sip_pvt *p, const char *msg, const
/*! \brief Parse first line of incoming SIP request */
static int determine_firstline_parts(struct sip_request *req)
{
- char *e = ast_skip_blanks(req->data->str); /* there shouldn't be any */
+ char *e = ast_skip_blanks(ast_str_buffer(req->data)); /* there shouldn't be any */
char *local_rlpart1;
if (!*e)
return -1;
- req->rlpart1 = e - req->data->str; /* method or protocol */
+ req->rlpart1 = e - ast_str_buffer(req->data); /* method or protocol */
local_rlpart1 = e;
e = ast_skip_nonblanks(e);
if (*e)
@@ -13734,7 +13734,7 @@ static int determine_firstline_parts(struct sip_request *req)
if (!strcasecmp(local_rlpart1, "SIP/2.0") ) { /* We have a response */
if (strlen(e) < 3) /* status code is 3 digits */
return -1;
- req->rlpart2 = e - req->data->str;
+ req->rlpart2 = e - ast_str_buffer(req->data);
} else { /* We have a request */
if ( *e == '<' ) { /* XXX the spec says it must not be in <> ! */
ast_debug(3, "Oops. Bogus uri in <> %s\n", e);
@@ -13742,7 +13742,7 @@ static int determine_firstline_parts(struct sip_request *req)
if (!*e)
return -1;
}
- req->rlpart2 = e - req->data->str; /* URI */
+ req->rlpart2 = e - ast_str_buffer(req->data); /* URI */
e = ast_skip_nonblanks(e);
if (*e)
*e++ = '\0';
@@ -16554,7 +16554,7 @@ static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *
return AUTH_SECRET_FAILED; /*! XXX \todo need a better return code here */
}
- c = buf->str;
+ c = ast_str_buffer(buf);
sip_digest_parser(c, keys);
@@ -16893,7 +16893,7 @@ static void transmit_fake_auth_response(struct sip_pvt *p, struct sip_request *r
return;
}
- c = buf->str;
+ c = ast_str_buffer(buf);
while (c && *(c = ast_skip_blanks(c))) { /* lookup for keys */
for (i = keys; i->key != NULL; i++) {
diff --git a/channels/sip/security_events.c b/channels/sip/security_events.c
index 28a14f8a5..691c5bde1 100644
--- a/channels/sip/security_events.c
+++ b/channels/sip/security_events.c
@@ -311,7 +311,7 @@ int sip_report_security_event(const struct sip_pvt *p, const struct sip_request
authtoken = sip_get_header(req, reqheader);
buf = ast_str_thread_get(&check_auth_buf, CHECK_AUTH_BUF_INITLEN);
ast_str_set(&buf, 0, "%s", authtoken);
- c = buf->str;
+ c = ast_str_buffer(buf);
sip_digest_parser(c, keys);