diff options
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 7426dee10..ea4a09175 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -876,6 +876,7 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GN | |||
876 | char * separator = NULL; | 876 | char * separator = NULL; |
877 | char hash[plugin->peer_id_length+1]; | 877 | char hash[plugin->peer_id_length+1]; |
878 | int hash_length; | 878 | int hash_length; |
879 | unsigned long int ctag; | ||
879 | 880 | ||
880 | /* URL parsing | 881 | /* URL parsing |
881 | * URL is valid if it is in the form [prefix with (multiple) '/'][peerid[103];tag]*/ | 882 | * URL is valid if it is in the form [prefix with (multiple) '/'][peerid[103];tag]*/ |
@@ -903,19 +904,26 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GN | |||
903 | if (debug) GNUNET_break (0); | 904 | if (debug) GNUNET_break (0); |
904 | return GNUNET_SYSERR; | 905 | return GNUNET_SYSERR; |
905 | } | 906 | } |
906 | (*tag) = strtoul (tag_start, &tag_end, 10); | 907 | ctag = strtoul (tag_start, &tag_end, 10); |
907 | if ((*tag) == 0) | 908 | if (ctag == 0) |
908 | { | 909 | { |
909 | /* tag == 0 , invalid */ | 910 | /* tag == 0 , invalid */ |
910 | if (debug) GNUNET_break (0); | 911 | if (debug) GNUNET_break (0); |
911 | return GNUNET_SYSERR; | 912 | return GNUNET_SYSERR; |
912 | } | 913 | } |
913 | if (((*tag) == ULONG_MAX) && (ERANGE == errno)) | 914 | if ((ctag == ULONG_MAX) && (ERANGE == errno)) |
914 | { | 915 | { |
915 | /* out of range: > ULONG_MAX */ | 916 | /* out of range: > ULONG_MAX */ |
916 | if (debug) GNUNET_break (0); | 917 | if (debug) GNUNET_break (0); |
917 | return GNUNET_SYSERR; | 918 | return GNUNET_SYSERR; |
918 | } | 919 | } |
920 | if (ctag > UINT32_MAX) | ||
921 | { | ||
922 | /* out of range: > UINT32_MAX */ | ||
923 | if (debug) GNUNET_break (0); | ||
924 | return GNUNET_SYSERR; | ||
925 | } | ||
926 | (*tag) = (uint32_t) ctag; | ||
919 | if (NULL == tag_end) | 927 | if (NULL == tag_end) |
920 | { | 928 | { |
921 | /* no char after tag */ | 929 | /* no char after tag */ |