/* * Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE.
*/
/* * This is originally from: * android-n-mr2-preview-1-303-gccec0f4c1 * libc/upstream-freebsd/lib/libc/stdlib/realpath.c
*/
#ifdefined(LIBC_SCCS) && !defined(lint) staticchar sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94"; #endif/* LIBC_SCCS and not lint */ #include <sys/param.h> #include <sys/stat.h>
// Original copy in, but not usable from here: // toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc static size_t my_strlcat(char* s1, constchar* s2, size_t len) {
size_t pos1 = 0;
/* * Original: realpath * Find the real name of path, by removing all ".", ".." and symlink * components. Returns (resolved) on success, or (NULL) on failure, * in which case the path which caused trouble is left in (resolved). * Changes: * Resolve relative paths, but don't allow backing out of a symlink * target. Fail with permission error if any dir is writable.
*/ char* SandboxBroker::SymlinkPath(const Policy* policy, constchar* __restrict path, char* __restrict resolved, int* perms) { struct stat sb; char *p, *q, *s;
size_t left_len, resolved_len, backup_allowed; unsigned symlinks; int m, slen; char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.