summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.c b/util.c
index 04e80b4..312bc2f 100644
--- a/util.c
+++ b/util.c
@@ -75,7 +75,7 @@ int get(char *host, char *path, char *sendcookie, char *savecookie, char **buf)
if(savecookie != NULL &&
(t2 = strstr(t, "Set-Cookie: ")) != NULL && sscanf(t2, m, c))
strncat(savecookie, c, COOKIEMAX);
- if((t2 = strstr(t, "\r\n\r\n")) != NULL) {
+ if((t2 = strstr(t, "\r\n\r\n")) != NULL && (t2 - t) < (signed)res) {
t2+=4;
l = res - (t2 - t);
*buf = malloc(sizeof(char *) * l);