[Systrace] filename normalisation breaks POSIX

Niels Provos provos at citi.umich.edu
Fri Jan 23 22:43:01 EST 2004


On Tue, Jan 20, 2004 at 10:29:20PM +0100, Nikolay Sturm wrote:
> Running the following test case with and without systrace shows the
> problem. (OpenBSD-current, in case it matters :)

The following diff fixes the problem:

Index: intercept.c
===================================================================
RCS file: /cvs/usr-systrace/intercept.c,v
retrieving revision 1.56
diff -u -r1.56 intercept.c
--- intercept.c	3 Jan 2004 18:30:37 -0000	1.56
+++ intercept.c	24 Jan 2004 03:40:40 -0000
@@ -664,6 +664,13 @@
 	static char cwd[2*MAXPATHLEN];
 	int havecwd = 0;
 
+	/* 
+	 * The empty filename does not receive normalization.
+	 * System calls are supposed to fail on it.
+	 */
+	if (strcmp(name, "") == 0)
+		return (name);
+
 	if (fd != -1 && intercept.setcwd(fd, pid) == -1) {
 		if (errno == EBUSY)
 			return (NULL);


More information about the systrace mailing list