]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ParserNG: fix typo in rev.13688
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 19 Nov 2014 22:29:50 +0000 (14:29 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 19 Nov 2014 22:29:50 +0000 (14:29 -0800)
Squid xstrncpy() assumes \0-termination and enforces it by overwriting
the last byte of the output. Un-terminated strings must have +1 length
delivered or they will be truncated.

src/http/one/Parser.cc

index 07696c80cf2af7571f3aa84a27b837b84844ee9e..10ed3603dc71cc34bb45e4507bc6f6fe96fbbce3 100644 (file)
@@ -71,7 +71,7 @@ Http::One::Parser::getHeaderField(const char *name)
         p.chop(0, sizeof(header)-1);
 
         // return the header field-value
-        xstrncpy(header, p.rawContent(), p.length());
+        xstrncpy(header, p.rawContent(), p.length()+1);
         debugs(25, 5, "returning " << header);
         return header;
     }