From 36eca5bf2cdc547f3a86dd2916c1559281952d17 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 20 Dec 2013 14:23:53 +0000 Subject: -give nicer warning about big regex --- src/regex/regex_api.c | 9 ++++++--- src/tun/regex.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/regex/regex_api.c b/src/regex/regex_api.c index e18674d65..0da97d072 100644 --- a/src/regex/regex_api.c +++ b/src/regex/regex_api.c @@ -105,7 +105,7 @@ handle_a_reconnect (void *cls, /** * Announce the given peer under the given regular expression. Does - * not free resources, must call GNUNET_REGEX_announce_cancel for + * not free resources, must call #GNUNET_REGEX_announce_cancel for * that. * * @param cfg configuration to use @@ -113,7 +113,7 @@ handle_a_reconnect (void *cls, * @param refresh_delay after what delay should the announcement be repeated? * @param compression How many characters per edge can we squeeze? * @return Handle to reuse o free cached resources. - * Must be freed by calling GNUNET_REGEX_announce_cancel. + * Must be freed by calling #GNUNET_REGEX_announce_cancel. */ struct GNUNET_REGEX_Announcement * GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, @@ -127,6 +127,9 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, slen = strlen (regex) + 1; if (slen + sizeof (struct AnnounceMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE) { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + _("Regex `%s' is too long!\n"), + regex); GNUNET_break (0); return NULL; } @@ -269,7 +272,7 @@ handle_search_response (void *cls, s->callback (s->callback_cls, pid, &pid[1], gpl, - &pid[1 + gpl], ppl); + &pid[1 + gpl], ppl); return; } } diff --git a/src/tun/regex.c b/src/tun/regex.c index a40b0545a..056062e5f 100644 --- a/src/tun/regex.c +++ b/src/tun/regex.c @@ -410,7 +410,7 @@ GNUNET_TUN_ipv4policy2regex (const char *policy) * Convert an exit policy to a regular expression. The exit policy * specifies a set of subnets this peer is willing to serve as an * exit for; the resulting regular expression will match the - * IPv6 address strings as returned by 'GNUNET_TUN_ipv6toregexsearch'. + * IPv6 address strings as returned by #GNUNET_TUN_ipv6toregexsearch(). * * @param policy exit policy specification * @return regular expression, NULL on error -- cgit v1.2.3