From 6d6b3e9c5aa621bf19b1f49aeada1949f64e080d Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 22 Aug 2011 00:31:48 +0100 Subject: Fix stability bug in page fetching --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3