summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2011-08-22 00:31:48 +0100
committerNick White <git@njw.me.uk>2011-08-22 00:31:48 +0100
commit6d6b3e9c5aa621bf19b1f49aeada1949f64e080d (patch)
tree521ff771aae8264baf5fddcaf43dc0784fd47ee0
parent7aa7f4055f8a966e7c3eb813b7d6c8a81c06e956 (diff)
Fix stability bug in page fetching
-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);