diff options
author | schanzen <schanzen@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-06-12 16:37:56 +0000 |
---|---|---|
committer | schanzen <schanzen@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-06-12 16:37:56 +0000 |
commit | ff6768faa6cf82d0ddedb268e133f915a9ec28f5 (patch) | |
tree | bd01b4fa66c8fbaf38e068debbb080250292bd84 /src | |
parent | 6319927cbbf84f9de302a8721c6a2e58e1033afc (diff) |
-fix html detection
git-svn-id: https://gnunet.org/svn/gnunet@21922 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 65139beb4c..c99010dc44 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -40,7 +40,7 @@ /* MHD/cURL defines */ #define BUF_WAIT_FOR_CURL 0 #define BUF_WAIT_FOR_MHD 1 -#define HTML_HDR_CONTENT "Content-Type: text/html\r\n" +#define HTML_HDR_CONTENT "Content-Type: text/html" /* regexp */ //#define RE_DOTPLUS "<a href=\"http://(([A-Za-z]+[.])+)([+])" @@ -373,10 +373,14 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls) { size_t bytes = size * nmemb; struct ProxyCurlTask *ctask = cls; - char hdr[bytes+1]; + int len = strlen (HTML_HDR_CONTENT); + char hdr[len+1]; + + if ( (len+1) > bytes) + return bytes; - memcpy (hdr, buffer, bytes); - hdr[bytes] = '\0'; + memcpy (hdr, buffer, len); + hdr[len] = '\0'; if (0 == strcmp (hdr, HTML_HDR_CONTENT)) { |