]> granicus.if.org Git - php/commitdiff
(symlink) Disable symlinks to urls
authorRasmus Lerdorf <rasmus@php.net>
Sun, 28 Nov 1999 16:23:30 +0000 (16:23 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Sun, 28 Nov 1999 16:23:30 +0000 (16:23 +0000)
@- Disable symlinks to urls

ext/standard/link.c

index b6071d4c09688546f2b87d651c433555dfb22d2a..077d63c524b9cab59de3853e5e57f0ebda02c8e8 100644 (file)
@@ -116,6 +116,10 @@ PHP_FUNCTION(symlink)
        if (PG(safe_mode) && !_php3_checkuid((*topath)->value.str.val, 2)) {
                RETURN_FALSE;
        }
+       if (!strncasecmp((*topath)->value.str.val,"http://",7) || !strncasecmp((*topath)->value.str.val,"ftp://",6)) {
+               php_error(E_WARNING, "Unable to symlink to a URL");
+               RETURN_FALSE;
+       }
 
        ret = symlink((*topath)->value.str.val, (*frompath)->value.str.val);
        if (ret == -1) {