From: Greg Beaver Date: Sun, 11 May 2008 22:59:16 +0000 (+0000) Subject: increase code coverage and fix tiny bug in handling of absolute links X-Git-Tag: RELEASE_2_0_0b1~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70d0a4c0456f4c53856e28963dd2275385589454;p=php increase code coverage and fix tiny bug in handling of absolute links --- diff --git a/ext/phar/tests/tar/files/biglink.tar b/ext/phar/tests/tar/files/biglink.tar new file mode 100644 index 0000000000..43bbf58423 Binary files /dev/null and b/ext/phar/tests/tar/files/biglink.tar differ diff --git a/ext/phar/tests/tar/links3.phpt b/ext/phar/tests/tar/links3.phpt new file mode 100644 index 0000000000..2241081660 --- /dev/null +++ b/ext/phar/tests/tar/links3.phpt @@ -0,0 +1,19 @@ +--TEST-- +Phar: tar with link to absolute path +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +echo $p['file.txt']->getContent(); +echo $p['my/file']->getContent(); +?> +===DONE=== +--EXPECT-- +my file +my file +===DONE=== diff --git a/ext/phar/util.c b/ext/phar/util.c index ddd51eb6fe..09258b1f96 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -33,7 +33,7 @@ static char *phar_get_link_location(phar_entry_info *entry TSRMLS_DC) return NULL; } if (entry->link[0] == '/') { - return entry->link; + return estrdup(entry->link + 1); } tmp = estrndup(entry->filename, entry->filename_len); p = strrchr(tmp, '/');