diff options
author | Nick White <git@njw.me.uk> | 2011-08-22 00:31:48 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2011-08-22 00:31:48 +0100 |
commit | 6d6b3e9c5aa621bf19b1f49aeada1949f64e080d (patch) | |
tree | 521ff771aae8264baf5fddcaf43dc0784fd47ee0 /util.c | |
parent | 7aa7f4055f8a966e7c3eb813b7d6c8a81c06e956 (diff) |
Fix stability bug in page fetching
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); |