summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2011-11-30 18:50:24 +0000
committerNick White <git@njw.me.uk>2011-11-30 18:50:24 +0000
commit83adb758f73ebc6a6c09b7dee82e139317b7ad0a (patch)
tree8e5f0f95bc9df3ccc46d985991975bb68d1a72b5 /util.c
parent3754eaa4326fad5daff9ea14d2dba518adaca2eb (diff)
Make http implementation more robust
Diffstat (limited to 'util.c')
-rw-r--r--util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.c b/util.c
index 207024a..b1f4c69 100644
--- a/util.c
+++ b/util.c
@@ -92,7 +92,7 @@ int get(char *host, char *path, char *sendcookie, char *savecookie, char **buf)
}
*buf = realloc(*buf, sizeof(char *) * (l+BUFSIZ));
- for(; (res = recv(fd, *buf+l, BUFSIZ, 0)) > 0; l+=res)
+ for(; buf != NULL && (res = recv(fd, *buf+l, BUFSIZ, 0)) > 0; l+=res)
*buf = realloc(*buf, sizeof(char *) * (l+BUFSIZ));
return l;