summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2012-04-21 15:48:37 +0100
committerNick White <git@njw.me.uk>2012-04-21 15:48:37 +0100
commit5c4aa011033ee1963e042a4d51d9eaa00216396b (patch)
tree7809b986f5f8e4218fb3e5173893bb4608a50e23
parent587a1b745710d2058f0b804c8be87bc55d25419b (diff)
Revert most of 4bfac013 as it caused cookie failure
-rw-r--r--getbnbook.c2
-rw-r--r--util.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/getbnbook.c b/getbnbook.c
index 720605d..d6f06b8 100644
--- a/getbnbook.c
+++ b/getbnbook.c
@@ -39,7 +39,7 @@ int getpagelist()
snprintf(url, URLMAX, "/DigBooks/viewer/bookviewmanager.aspx?op=getbookinfo&ean=%s", bookid);
- if(!get("search2.barnesandnoble.com", url, NULL, cookies, &buf))
+ if(!get("search2.barnesandnoble.com", url, cookies, NULL, &buf))
return 1;
/* find page url structure */
diff --git a/util.c b/util.c
index 093c157..41bbc3c 100644
--- a/util.c
+++ b/util.c
@@ -72,7 +72,7 @@ int get(char *host, char *path, char *sendcookie, char *savecookie, char **buf)
snprintf(m, 256, "Set-Cookie: %%%ds;", COOKIEMAX-1);
while((res = recv(fd, t, BUFSIZ, 0)) > 0) {
- strncat(h, t, sizeof(h) - strlen(h) - 1);
+ strncat(h, t, BUFSIZ - strlen(h) - 1);
if((t2 = strstr(t, "\r\n\r\n")) != NULL && (t2 - t) < (signed)res) {
/* end of header, save rest to buffer */
t2+=4;
@@ -91,7 +91,7 @@ int get(char *host, char *path, char *sendcookie, char *savecookie, char **buf)
t2 = h;
if(savecookie != NULL) {
while((t2 = strstr(t2, "Set-Cookie: ")) && sscanf(t2, m, c)) {
- strncat(savecookie, c, sizeof(savecookie) - strlen(savecookie) - 1);
+ strncat(savecookie, c, COOKIEMAX - strlen(savecookie) - 1);
t2++;
}
}