php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48640 compilation broken for NetWare because of wrong ifdefs
Submitted: 2009-06-22 10:49 UTC Modified: 2009-08-26 02:17 UTC
From: guenter@php.net Assigned: guenter (profile)
Status: Closed Package: Zip Related
PHP Version: 5.2.10 OS: NetWare
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: guenter@php.net
New email:
PHP Version: OS:

 

 [2009-06-22 10:49 UTC] guenter@php.net
Description:
------------
compilation breaks in php_zip.c function php_zip_realpath_r() because of wrong ifdefs for NetWare which leads to a missing brace.
Although its sufficient to remove the code lines 157-161 I strongly suggest to cleanup the function code since the rest of ifdefs is very confusing. Please apply the patch below to a copy of php_zip.c and compare the result against the current code to verify the patch -- reading the diff properly might be _very_ confusing!

--- php_zip.c.orig	Thu Feb 05 20:53:22 2009
+++ php_zip.c	Fri Mar 27 10:31:02 2009
@@ -148,51 +148,28 @@
 			}
 			return j;
 		}
-	
-		path[len] = 0;
 
-#ifdef PHP_WIN32
-		tmp = tsrm_do_alloca(len+1);
-		memcpy(tmp, path, len+1);
-#elif defined(NETWARE)
+		path[len] = 0;
 
 		tmp = tsrm_do_alloca(len+1);
 		memcpy(tmp, path, len+1);
-#else
-		tmp = tsrm_do_alloca(len+1);
-		memcpy(tmp, path, len+1);
 
-		{
-#endif
-			if (i - 1 <= start) {
-				j = start;
-			} else {
-				/* some leading directories may be unaccessable */
-				j = php_zip_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC);
-				if (j > start) {
-					path[j++] = DEFAULT_SLASH;
-				}
+		if (i - 1 <= start) {
+			j = start;
+		} else {
+			/* some leading directories may be unaccessable */
+			j = php_zip_realpath_r(path, start, i-1, ll, t, use_realpath, 1, NULL TSRMLS_CC);
+			if (j > start) {
+				path[j++] = DEFAULT_SLASH;
 			}
-#ifdef PHP_WIN32
-			if (j < 0 || j + len - i >= MAXPATHLEN-1) {
-				tsrm_free_alloca(tmp);
-
-				return -1;
-			}
-			{
-				/* use the original file or directory name as it wasn't found */
-				memcpy(path+j, tmp+i, len-i+1);
-				j += (len-i);
-			}
-#else
-			if (j < 0 || j + len - i >= MAXPATHLEN-1) {
-				tsrm_free_alloca(tmp);
-				return -1;
-			}
-			memcpy(path+j, tmp+i, len-i+1);
-			j += (len-i);
 		}
-#endif
+		if (j < 0 || j + len - i >= MAXPATHLEN-1) {
+			tsrm_free_alloca(tmp);
+			return -1;
+		}
+		/* use the original file or directory name as it wasn't found */
+		memcpy(path+j, tmp+i, len-i+1);
+		j += (len-i);
 
 		tsrm_free_alloca(tmp);
 		return j;



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-23 12:39 UTC] iliaa@php.net
Why are the win32 defines being removed in the patch?
 [2009-06-23 12:44 UTC] pajoye@php.net
Ilia, he can commit himself now. Afaics, this patch is only a cleanup for other platforms, where the #ifdef clauses contain the same code.
 [2009-06-23 13:52 UTC] pajoye@php.net
Pls commit yourself :)
 [2009-06-23 23:24 UTC] guenter@php.net
Here's a 'diff -wu php_zip.c.orig php_zip.c' which probably shows better what the patch really does:
http://www.gknw.net/~gknw/php_zip.c.diff.html
 [2009-08-26 02:16 UTC] svn@php.net
Automatic comment from SVN on behalf of guenter
Revision: http://svn.php.net/viewvc/?view=revision&revision=287723
Log: fix bug #48640: cleaned up ifdef whoes, removed duplicate code.
 [2009-08-26 02:17 UTC] guenter@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC