[asterisk-commits] rmudgett: branch 13 r428246 - in /branches/13: ./ channels/ channels/sip/ mai...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 19 11:13:34 CST 2014


Author: rmudgett
Date: Wed Nov 19 11:13:29 2014
New Revision: 428246

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=428246
Log:
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

Modified:
    branches/13/   (props changed)
    branches/13/channels/chan_sip.c
    branches/13/channels/sip/security_events.c
    branches/13/main/manager.c
    branches/13/res/res_calendar.c

Propchange: branches/13/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: branches/13/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/channels/chan_sip.c?view=diff&rev=428246&r1=428245&r2=428246
==============================================================================
--- branches/13/channels/chan_sip.c (original)
+++ branches/13/channels/chan_sip.c Wed Nov 19 11:13:29 2014
@@ -9580,7 +9580,7 @@
 	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;
@@ -9621,7 +9621,7 @@
 			lws = 0;
 	}
 	msgbuf[t] = '\0';
-	data->used = t;
+	ast_str_update(data);
 }
 
 /*! \brief Parse a SIP message
@@ -9629,7 +9629,7 @@
 */
 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;
@@ -13706,12 +13706,12 @@
 /*! \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)
@@ -13725,7 +13725,7 @@
 	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);
@@ -13733,7 +13733,7 @@
 			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';
@@ -16545,7 +16545,7 @@
 		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);
 
@@ -16884,7 +16884,7 @@
 		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++) {

Modified: branches/13/channels/sip/security_events.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/channels/sip/security_events.c?view=diff&rev=428246&r1=428245&r2=428246
==============================================================================
--- branches/13/channels/sip/security_events.c (original)
+++ branches/13/channels/sip/security_events.c Wed Nov 19 11:13:29 2014
@@ -311,7 +311,7 @@
 		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);
 

Modified: branches/13/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/manager.c?view=diff&rev=428246&r1=428245&r2=428246
==============================================================================
--- branches/13/main/manager.c (original)
+++ branches/13/main/manager.c Wed Nov 19 11:13:29 2014
@@ -2139,6 +2139,7 @@
 	struct manager_action *cur;
 	struct ast_str *authority;
 	int num, l, which;
+	const char *auth_str;
 	char *ret = NULL;
 #ifdef AST_XML_DOCS
 	char syntax_title[64], description_title[64], synopsis_title[64], seealso_title[64];
@@ -2186,7 +2187,7 @@
 	AST_RWLIST_TRAVERSE(&actions, cur, list) {
 		for (num = 3; num < a->argc; num++) {
 			if (!strcasecmp(cur->action, a->argv[num])) {
-				authority_to_str(cur->authority, &authority);
+				auth_str = authority_to_str(cur->authority, &authority);
 
 #ifdef AST_XML_DOCS
 				if (cur->docsrc == AST_XML_DOC) {
@@ -2195,7 +2196,7 @@
 					char *description = ast_xmldoc_printable(S_OR(cur->description, "Not available"), 1);
 					char *arguments = ast_xmldoc_printable(S_OR(cur->arguments, "Not available"), 1);
 					char *seealso = ast_xmldoc_printable(S_OR(cur->seealso, "Not available"), 1);
-					char *privilege = ast_xmldoc_printable(S_OR(authority->str, "Not available"), 1);
+					char *privilege = ast_xmldoc_printable(S_OR(auth_str, "Not available"), 1);
 					char *responses = ast_xmldoc_printable("None", 1);
 					ast_cli(a->fd, "%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s",
 						syntax_title, syntax,
@@ -2229,7 +2230,7 @@
 				{
 					ast_cli(a->fd, "Action: %s\nSynopsis: %s\nPrivilege: %s\n%s\n",
 						cur->action, cur->synopsis,
-						authority->str,
+						auth_str,
 						S_OR(cur->description, ""));
 				}
 			}

Modified: branches/13/res/res_calendar.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_calendar.c?view=diff&rev=428246&r1=428245&r2=428246
==============================================================================
--- branches/13/res/res_calendar.c (original)
+++ branches/13/res/res_calendar.c Wed Nov 19 11:13:29 2014
@@ -803,7 +803,7 @@
 
 	for (itervar = event->owner->vars; itervar; itervar = itervar->next) {
 		ast_str_substitute_variables(&tmpstr, 0, chan, itervar->value);
-		pbx_builtin_setvar_helper(chan, itervar->name, tmpstr->str);
+		pbx_builtin_setvar_helper(chan, itervar->name, ast_str_buffer(tmpstr));
 	}
 
 	if (!(apptext = ast_str_create(32))) {




More information about the asterisk-commits mailing list