free(oldnamew);
SET_ERRNO_FROM_WIN32_CODE(ERROR_INVALID_PARAMETER);
return -1;
- } else if (!PHP_WIN32_IOUTIL_PATH_IS_OK_W(newnamew, wcslen(newnamew))) {
- free(oldnamew);
- free(newnamew);
- SET_ERRNO_FROM_WIN32_CODE(ERROR_ACCESS_DENIED);
- return -1;
+ } else {
+ size_t newnamew_len = wcslen(newnamew);
+ if (!PHP_WIN32_IOUTIL_PATH_IS_OK_W(newnamew, newnamew_len)) {
+ free(oldnamew);
+ free(newnamew);
+ SET_ERRNO_FROM_WIN32_CODE(ERROR_ACCESS_DENIED);
+ return -1;
+ }
}
ret = php_win32_ioutil_rename_w(oldnamew, newnamew);