summaryrefslogtreecommitdiff
path: root/win32/winutil.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2010-02-07 20:15:58 +0000
committerPierre Joye <pajoye@php.net>2010-02-07 20:15:58 +0000
commit658e86b847b843e08c9576b21af31e3f1e316531 (patch)
tree654da51c9016d55ab2c6a5baec3a330aa691fd97 /win32/winutil.c
parentc58f63a38ae19caaab339c61486fc3bd7e5894f9 (diff)
downloadphp-git-658e86b847b843e08c9576b21af31e3f1e316531.tar.gz
- prevent unexpectable behaviors (for the user) with invalid path
Diffstat (limited to 'win32/winutil.c')
-rw-r--r--win32/winutil.c15
1 files changed, 15 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;
+ }
+}