diff options
author | Pierre Joye <pajoye@php.net> | 2010-02-07 20:15:58 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2010-02-07 20:15:58 +0000 |
commit | 658e86b847b843e08c9576b21af31e3f1e316531 (patch) | |
tree | 654da51c9016d55ab2c6a5baec3a330aa691fd97 /win32 | |
parent | c58f63a38ae19caaab339c61486fc3bd7e5894f9 (diff) | |
download | php-git-658e86b847b843e08c9576b21af31e3f1e316531.tar.gz |
- prevent unexpectable behaviors (for the user) with invalid path
Diffstat (limited to 'win32')
-rw-r--r-- | win32/winutil.c | 15 | ||||
-rw-r--r-- | win32/winutil.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/win32/winutil.c b/win32/winutil.c index 7e1cf3fc91..24b00edfae 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -31,3 +31,18 @@ PHPAPI char *php_win_err(int error) return (buf ? (char *) buf : ""); } + +int php_win32_check_trailing_space(const char * path, const int path_len) { + if (path_len < 1) { + return 1; + } + if (path) { + if (path[0] == ' ' || path[path_len - 1] == ' ') { + return 0; + } else { + return 1; + } + } else { + return 0; + } +} diff --git a/win32/winutil.h b/win32/winutil.h index 36b10200cb..8ee75752da 100644 --- a/win32/winutil.h +++ b/win32/winutil.h @@ -19,3 +19,4 @@ PHPAPI char *php_win_err(int error); #define php_win_err() php_win_err(GetLastError()) +int php_win32_check_trailing_space(const char * path, const int path_len); |