[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25705 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25705 - gnunet/src/transport |
Date: |
Mon, 7 Jan 2013 15:25:57 +0100 |
Author: wachs
Date: 2013-01-07 15:25:57 +0100 (Mon, 07 Jan 2013)
New Revision: 25705
Modified:
gnunet/src/transport/plugin_transport_http_server.c
Log:
- remove url parsing breaks for invalid requests
Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2013-01-07 06:28:53 UTC
(rev 25704)
+++ gnunet/src/transport/plugin_transport_http_server.c 2013-01-07 14:25:57 UTC
(rev 25705)
@@ -45,6 +45,11 @@
#define _RECEIVE 0
#define _SEND 1
+
+/* Enable output for debbuging URL's of incoming requests */
+#define DEBUG_URL_PARSE GNUNET_NO
+
+
/**
* Encapsulation of all of the state of the plugin.
*/
@@ -891,8 +896,6 @@
static int
server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct
GNUNET_PeerIdentity * target, uint32_t *tag)
{
- int debug = GNUNET_YES;
-
char * tag_start = NULL;
char * tag_end = NULL;
char * target_start = NULL;
@@ -916,7 +919,7 @@
if (NULL == separator)
{
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
tag_start = separator + 1;
@@ -924,42 +927,42 @@
if (strlen (tag_start) == 0)
{
/* No tag after separator */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
ctag = strtoul (tag_start, &tag_end, 10);
if (ctag == 0)
{
/* tag == 0 , invalid */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
if ((ctag == ULONG_MAX) && (ERANGE == errno))
{
/* out of range: > ULONG_MAX */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
if (ctag > UINT32_MAX)
{
/* out of range: > UINT32_MAX */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
(*tag) = (uint32_t) ctag;
if (NULL == tag_end)
{
/* no char after tag */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
if (url[strlen(url)] != tag_end[0])
{
/* there are more not converted chars after tag */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
- if (debug)
+ if (DEBUG_URL_PARSE)
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"Found tag `%u' in url\n", (*tag));
@@ -975,7 +978,7 @@
if (hash_length != plugin->peer_id_length)
{
/* no char after tag */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
memcpy (hash, target_start, hash_length);
@@ -984,7 +987,7 @@
if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((const char *) hash,
&(target->hashPubKey)))
{
/* hash conversion failed */
- if (debug) GNUNET_break (0);
+ if (DEBUG_URL_PARSE) GNUNET_break (0);
return GNUNET_SYSERR;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25705 - gnunet/src/transport,
gnunet <=