summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-10-23 00:43:27 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-10-23 00:43:27 +0200
commit3bb7ad61aa05fca94fe508914ad5bbf4cf3a86f6 (patch)
tree634aec15fd8fa49084a271d79eb848b9b3da7ced
parent89e63156991a50263eb6481934ce1c40e4a13036 (diff)
downloadplan9front-3bb7ad61aa05fca94fe508914ad5bbf4cf3a86f6.tar.xz
lib9p: prevent files from being created in deleted directories (thanks BurnZeZ)
-rw-r--r--sys/src/lib9p/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/src/lib9p/file.c b/sys/src/lib9p/file.c
index 54e09d278..476a8e052 100644
--- a/sys/src/lib9p/file.c
+++ b/sys/src/lib9p/file.c
@@ -191,6 +191,12 @@ createfile(File *fp, char *name, char *uid, ulong perm, void *aux)
}
wlock(fp);
+ if(fp->parent == nil){
+ wunlock(fp);
+ werrstr("create in deleted directory");
+ return nil;
+ }
+
/*
* We might encounter blank spots along the
* way due to deleted files that have not yet