diff options
author | Nick White <git@njw.me.uk> | 2012-07-13 18:20:13 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2012-07-13 18:20:13 +0100 |
commit | 51c41296bca9e06cfa2d53ce3a0837e1a8697b1c (patch) | |
tree | a77825784861c85e8509f25cc9d6de9d619b26f6 /getgbook.c | |
parent | 8f03147275f2522fa9d5dd16ed3e875dfffe515e (diff) |
Ensure text downloaded is null terminated
Diffstat (limited to 'getgbook.c')
-rw-r--r-- | getgbook.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -44,7 +44,7 @@ int getpagelist() snprintf(url, URLMAX, "/books?id=%s&printsec=frontcover&redir_esc=y", bookid); - if(!get("books.google.com", url, NULL, NULL, &buf)) + if(!get("books.google.com", url, NULL, NULL, &buf, 1)) return 1; if((s = strstr(buf, "_OC_Run({\"page\":[")) == NULL) @@ -83,7 +83,7 @@ int getpageurls(char *pagecode, char *cookie) snprintf(url, URLMAX, "/books?id=%s&pg=%s&jscmd=click3&q=subject:a&redir_esc=y", bookid, pagecode); - if(!get("books.google.com", url, cookie, NULL, &buf)) + if(!get("books.google.com", url, cookie, NULL, &buf, 1)) return 1; c = buf; @@ -133,7 +133,7 @@ int getpage(Page *page) return 1; } - if(gettofile("books.google.com", page->url, page->cookie, NULL, path)) { + if(gettofile("books.google.com", page->url, page->cookie, NULL, path, 0)) { fprintf(stderr, "%s failed\n", page->name); return 1; } @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) /* get cookies */ for(i=0;i<COOKIENUM;i++) { - if(get("books.google.com", "/", NULL, cookies[i], &tmp)) + if(get("books.google.com", "/", NULL, cookies[i], &tmp, 0)) free(tmp); } |