Skip to content
Browse files

Merge: Fix bug #61184 Phar::webPhar() generates headers with trailing…

… NUL bytes
  • Loading branch information...
1 parent 09f24e0 commit d256caf7815d7f8714097984d4a29d109ae8c5f2 @nikic nikic committed Mar 2, 2012
Showing with 6 additions and 3 deletions.
  1. +3 −0 NEWS
  2. +3 −3 ext/phar/phar_object.c
View
3 NEWS
@@ -28,6 +28,9 @@ PHP NEWS
- Installation
. Fixed bug #61172 (Add Apache 2.4 support). (Chris Jones)
+- Phar
+ . Fixed bug #61184 (Phar::webPhar() generates headers with trailing NUL bytes). (Nikita Popov)
+
- Reflection:
. Fixed bug #60968 (Late static binding doesn't work with
ReflectionMethod::invokeArgs()). (Laruence)
View
6 ext/phar/phar_object.c
@@ -428,7 +428,7 @@ static void phar_do_403(char *entry, int entry_len TSRMLS_DC) /* {{{ */
sapi_header_line ctr = {0};
ctr.response_code = 403;
- ctr.line_len = sizeof("HTTP/1.0 403 Access Denied");
+ ctr.line_len = sizeof("HTTP/1.0 403 Access Denied")-1;
ctr.line = "HTTP/1.0 403 Access Denied";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);
@@ -453,7 +453,7 @@ static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, cha
}
ctr.response_code = 404;
- ctr.line_len = sizeof("HTTP/1.0 404 Not Found")+1;
+ ctr.line_len = sizeof("HTTP/1.0 404 Not Found")-1;
ctr.line = "HTTP/1.0 404 Not Found";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);
@@ -893,7 +893,7 @@ PHP_METHOD(Phar, webPhar)
char *tmp = NULL, sa = '\0';
sapi_header_line ctr = {0};
ctr.response_code = 301;
- ctr.line_len = sizeof("HTTP/1.1 301 Moved Permanently")+1;
+ ctr.line_len = sizeof("HTTP/1.1 301 Moved Permanently")-1;
ctr.line = "HTTP/1.1 301 Moved Permanently";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);

0 comments on commit d256caf

Please sign in to comment.
Something went wrong with that request. Please try again.