summaryrefslogtreecommitdiff
path: root/src/lib/rib.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2018-10-06 18:06:47 +0200
committerDimitri Staessens <[email protected]>2018-10-06 18:06:47 +0200
commit0b2e5c5410580c755cef02114e51f15b19cfaffa (patch)
tree63d684e6057c9caa43739b599d54a72f9959d4f8 /src/lib/rib.c
parentbfc29ca20406ccd69363b0f9796987534318e7ae (diff)
parentd9ad3852613cda026d4520b5c608ada7433dd7d9 (diff)
downloadouroboros-0b2e5c5410580c755cef02114e51f15b19cfaffa.tar.gz
ouroboros-0b2e5c5410580c755cef02114e51f15b19cfaffa.zip
Merge branch 'testing' into be
Diffstat (limited to 'src/lib/rib.c')
-rw-r--r--src/lib/rib.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/rib.c b/src/lib/rib.c
index 685575e5..88db9ed8 100644
--- a/src/lib/rib.c
+++ b/src/lib/rib.c
@@ -101,6 +101,9 @@ static int rib_read(const char * path,
char comp[RIB_PATH_LEN + 1];
char * c;
+ if (strlen(path) > RIB_PATH_LEN)
+ return -1;
+
strcpy(comp, path + 1);
c = strstr(comp, "/");
@@ -183,6 +186,9 @@ static size_t __getattr(const char * path,
char comp[RIB_PATH_LEN + 1];
char * c;
+ if (strlen(path) > RIB_PATH_LEN)
+ return -1;
+
strcpy(comp, path + 1);
c = strstr(comp, "/");
@@ -282,7 +288,8 @@ int rib_init(const char * mountpt)
if (stat(rib.mnt, &st) == -1)
switch(errno) {
case ENOENT:
- mkdir(rib.mnt, 0777);
+ if (mkdir(rib.mnt, 0777))
+ return -1;
break;
case ENOTCONN:
fuse_unmount(rib.mnt, rib.ch);
@@ -385,6 +392,12 @@ int rib_reg(const char * path,
return -ENOMEM;
}
+ if (strlen(path) > RIB_PATH_LEN) {
+ pthread_rwlock_unlock(&rib.lock);
+ free(rc);
+ return -1;
+ }
+
strcpy(rc->path, path);
rc->ops = ops;