From a7846189cdb09a9d7ecca43f045cd0fb4517fe39 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 29 May 2005 22:30:48 +0000 Subject: [PATCH] Eric Cooper reported about a problem with HTTP servers that responds with binary zeroes within the headers. They confused libcurl to do wrong so the downloaded headers become incomplete. The fix is now verified with test case 262. --- CHANGES | 6 ++++++ lib/transfer.c | 4 ++-- tests/data/Makefile.am | 2 +- tests/data/test262 | Bin 0 -> 1114 bytes 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 tests/data/test262 diff --git a/CHANGES b/CHANGES index b8ea14d8c..10959713b 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,12 @@ Changelog +Daniel (30 May 2005) +- Eric Cooper reported about a problem with HTTP servers that responds with + binary zeroes within the headers. They confused libcurl to do wrong so the + downloaded headers become incomplete. The fix is now verified with test case + 262. + Daniel (24 May 2005) - Andres Garcia provided a text mode patch for several test cases so that they do text comparisions better on Windows (newline-wise). diff --git a/lib/transfer.c b/lib/transfer.c index 3c1b52a21..fdc825bd2 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -360,7 +360,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, /* str_start is start of line within buf */ k->str_start = k->str; - k->end_ptr = strchr (k->str_start, '\n'); + k->end_ptr = memchr(k->str_start, '\n', nread); if (!k->end_ptr) { /* Not a complete header line within buffer, append the data to @@ -428,7 +428,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, } /* copy to end of line */ - strncpy (k->hbufp, k->str_start, full_length); + memcpy(k->hbufp, k->str_start, full_length); k->hbufp += full_length; k->hbuflen += full_length; *k->hbufp = 0; diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 8d64cf81a..50ef1ec8c 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -32,4 +32,4 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \ test231 test232 test228 test229 test233 test234 test235 test236 test520 \ test237 test238 test239 test243 test245 test246 test247 test248 test249 \ test250 test251 test252 test253 test254 test255 test521 test522 test523 \ - test256 test257 test258 test259 test260 test261 + test256 test257 test258 test259 test260 test261 test262 diff --git a/tests/data/test262 b/tests/data/test262 new file mode 100644 index 0000000000000000000000000000000000000000..b9b5a61f456170048c5f49207a75e0bdd050dd77 GIT binary patch literal 1114 zcmYjQYj2w{6wPN#{SQ{BeW{l6Xvh}CBC&)ftRZO=LYjP-1lZvbun{;9^6O_qx=uWV zuP^7E>vOM>kUbp&q$745>~20=~c%E>F1ZRtdtuC~=Y1 z90d8yhk;+=e(z_EIo9fVxn7TcTxO{iIjMQJt-;JR3v2tn%ofS7wLe`~_Sn>HOFN;& ztevrSw#SydNZ+(YlaJ<}X}+vguLdahYW|bFd!Ng*_jwkQT^1&Te7j*82X(e0zE)1V zNtXK??;r@!Mi5w6+bWcxA>bm$Rt*-Zb^f1W=`G{kl}2`IU!1Y6%r?t(Udz{o`=&ZV z&B!)Khv#&wdS^6JR@;q6cJEH#p8VDTns`^PU>vBLyxVA8#U%@JB>Q6;%_H;WO&uJA z+)L3UI|V6?w(8{+s%s87KLuo&1>}u+)9k!+X(YgUXf&W`qEsAof;QR_uN1o5Jd2Vv zUOs;ua}*UkcBz6h{mE?-XFmk32VsoEL+hlZJStF?Ww?0hfU(c84&C_p4ax&JrzgIn z$WZC&y@AeiCXU+yt+P60xMJO^v02*t2iyTOpGO>ul6`^^$2sC}Pj%wM>@P$6VZ}8*31I#eQ1?w(-65&dRLCwiJU_=SSgmq__L@d@} zzX=f>vV;;Hh8eB6ijOR}E_g8vUzilLJnMkxBO!G+#y;1^yN}-;0AieF^maVAW8te? z!vfLCqbw1mZ6}A#g12&8_z=X575s;fB{YbiCgyip8Eu~fVw1ooi0|c{i=Tz}%Len7?PZ zge=C5M=AKWi?(Yeu|G{qaFm)5eXWq>P3%8v;>^ qPymG-(KB~oN-L&wPrpCP{8B!Z-rele;e+&W2ktoFCy*h1u>S?wc3HIm literal 0 HcmV?d00001