mirror of
https://github.com/YGGverse/next.git
synced 2025-01-12 08:08:29 +00:00
add absolute path validation
This commit is contained in:
parent
2cc63b3a36
commit
8ee31bdbf9
18
src/nex.php
18
src/nex.php
@ -38,6 +38,15 @@ foreach ((array) $argv as $item)
|
|||||||
DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR
|
||||||
) . DIRECTORY_SEPARATOR;
|
) . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
|
if (!str_starts_with($path, DIRECTORY_SEPARATOR))
|
||||||
|
{
|
||||||
|
print(
|
||||||
|
_('absolute path required')
|
||||||
|
) . PHP_EOL;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_dir($path) || !is_readable($path))
|
if (!is_dir($path) || !is_readable($path))
|
||||||
{
|
{
|
||||||
print(
|
print(
|
||||||
@ -70,6 +79,15 @@ foreach ((array) $argv as $item)
|
|||||||
DIRECTORY_SEPARATOR
|
DIRECTORY_SEPARATOR
|
||||||
) . DIRECTORY_SEPARATOR;
|
) . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
|
if (!str_starts_with($fail, DIRECTORY_SEPARATOR))
|
||||||
|
{
|
||||||
|
print(
|
||||||
|
_('absolute path required')
|
||||||
|
) . PHP_EOL;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_file($fail) || !is_readable($fail))
|
if (!is_file($fail) || !is_readable($fail))
|
||||||
{
|
{
|
||||||
print(
|
print(
|
||||||
|
Loading…
Reference in New Issue
Block a user