diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
| commit | 993e1866df547532a05ab6db76c9ff5aefc9a3df (patch) | |
| tree | 169d3bde0974235d3cde164786ef6f381a4749a7 /main/safe_mode.c | |
| parent | 1f589a2bd44ba835ad1b009a5d83abd453724829 (diff) | |
| download | php-upstream/5.2.6.tar.gz | |
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'main/safe_mode.c')
| -rw-r--r-- | main/safe_mode.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/main/safe_mode.c b/main/safe_mode.c index 798133e8d..74188a895 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.62.2.1.2.13 2007/10/11 09:33:53 jani Exp $ */ +/* $Id: safe_mode.c,v 1.62.2.1.2.15 2007/12/31 07:20:15 sebastian Exp $ */ #include "php.h" @@ -122,10 +122,17 @@ PHPAPI int php_checkuid_ex(const char *filename, const char *fopen_mode, int mod /* Trim off filename */ if ((s = strrchr(path, DEFAULT_SLASH))) { - if (s == path) - path[1] = '\0'; - else + if (*(s + 1) == '\0' && s != path) { /* make sure that the / is not the last character */ *s = '\0'; + s = strrchr(path, DEFAULT_SLASH); + } + if (s) { + if (s == path) { + path[1] = '\0'; + } else { + *s = '\0'; + } + } } } else { /* CHECKUID_ALLOW_ONLY_DIR */ s = strrchr(filename, DEFAULT_SLASH); |
