[asterisk-commits] kharwell: trunk r415358 - in /trunk: main/uri.c tests/test_websocket_client.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 6 15:45:11 CDT 2014
Author: kharwell
Date: Fri Jun 6 15:45:05 2014
New Revision: 415358
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=415358
Log:
core uri: Custom uri parsing error when no query parameters
If using the custom URI parsing code (not external uriparser lib) and there
was no query parameters the resulting pointer would be NULL and then an
attempt was made to subtract from it. The pointer is now set to a valid
value if there is no query parameter(s).
Also, in the 'ast_uri_make_host_with_port' function when setting the terminator
on the resulting string it was writing it one past the end of allocated memory.
It now writes the string terminator appropriately.
Modified:
trunk/main/uri.c
trunk/tests/test_websocket_client.c
Modified: trunk/main/uri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/uri.c?view=diff&rev=415358&r1=415357&r2=415358
==============================================================================
--- trunk/main/uri.c (original)
+++ trunk/main/uri.c Fri Jun 6 15:45:05 2014
@@ -229,6 +229,8 @@
if ((p = strchr(uri, '?'))) {
query = p + 1;
size_query = strlen(query) + 1;
+ } else {
+ p = uri + strlen(uri);
}
if (!host) {
@@ -313,9 +315,9 @@
if (ast_uri_port(uri)) {
res[host_size] = ':';
memcpy(res + host_size + 1,
- ast_uri_port(uri), port_size);
- }
-
- res[host_size + port_size + 1] = '\0';
+ ast_uri_port(uri), port_size - 1);
+ }
+
+ res[host_size + port_size] = '\0';
return res;
}
Modified: trunk/tests/test_websocket_client.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_websocket_client.c?view=diff&rev=415358&r1=415357&r2=415358
==============================================================================
--- trunk/tests/test_websocket_client.c (original)
+++ trunk/tests/test_websocket_client.c Fri Jun 6 15:45:05 2014
@@ -41,7 +41,7 @@
#include "asterisk/http_websocket.h"
#define CATEGORY "/res/websocket/"
-#define REMOTE_URL "ws://localhost:8088/ws"
+#define REMOTE_URL "ws://127.0.0.1:8088/ws"
AST_TEST_DEFINE(websocket_client_create_and_connect)
{
More information about the asterisk-commits
mailing list