From eb882894935ee252550e32f74fdc3dbe3513789c Mon Sep 17 00:00:00 2001 From: Martin Schlemmer Date: Tue, 14 Oct 2003 20:24:39 +0000 Subject: Fix a bug that occurs mainly on 64bit arch, where the file passed to the functions we wrap, is invalid, and then cause canonicalize to pass garbage to before_syscall(), thanks to great detective work from Andrea Luzzardi . --- src/sandbox-1.1/ChangeLog | 8 +++++++- src/sandbox-1.1/libsandbox.c | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sandbox-1.1/ChangeLog b/src/sandbox-1.1/ChangeLog index 259a801..e14f40d 100644 --- a/src/sandbox-1.1/ChangeLog +++ b/src/sandbox-1.1/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for Path Sandbox # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/ChangeLog,v 1.25 2003/10/13 19:45:54 azarah Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/ChangeLog,v 1.26 2003/10/14 20:24:39 azarah Exp $ + + 14 Oct 2003; Martin Schlemmer libsandbox.c : + Fix a bug that occurs mainly on 64bit arch, where the file passed to + the functions we wrap, is invalid, and then cause canonicalize to pass + garbage to before_syscall(), thanks to great detective work from + Andrea Luzzardi . 13 Oct 2003; Martin Schlemmer create-localdecls : Add a uClibc detection patch from Peter S. Mazinger . diff --git a/src/sandbox-1.1/libsandbox.c b/src/sandbox-1.1/libsandbox.c index c830591..ab96507 100644 --- a/src/sandbox-1.1/libsandbox.c +++ b/src/sandbox-1.1/libsandbox.c @@ -25,7 +25,7 @@ * as some of the InstallWatch code was used. * * - * $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/libsandbox.c,v 1.12 2003/10/13 19:43:25 azarah Exp $ + * $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/libsandbox.c,v 1.13 2003/10/14 20:24:39 azarah Exp $ * */ @@ -281,6 +281,8 @@ canonicalize(const char *path, char *resolved_path) int old_errno = errno; char *retval; + *resolved_path = '\0'; + /* If path == NULL, return or we get a segfault */ if (NULL == path) { errno = EINVAL; @@ -1283,6 +1285,11 @@ before_syscall(const char *func, const char *file) int result = 1; sbcontext_t sbcontext; + if (!strlen(file)) { + errno = EINVAL; + return 0; + } + init_context(&sbcontext); init_env_entries(&(sbcontext.deny_prefixes), -- cgit v1.2.3-65-gdbad