diff options
Diffstat (limited to 'src/user/lib/fs/dir.c')
-rw-r--r-- | src/user/lib/fs/dir.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/user/lib/fs/dir.c b/src/user/lib/fs/dir.c index 0529bfe..35028bd 100644 --- a/src/user/lib/fs/dir.c +++ b/src/user/lib/fs/dir.c @@ -1,5 +1,6 @@ #include <camellia/syscalls.h> #include <errno.h> +#include <limits.h> #include <string.h> #include <user/lib/fs/dir.h> @@ -20,10 +21,14 @@ bool dir_append(struct dirbuild *db, const char *name) { bool dir_appendl(struct dirbuild *db, const char *name, size_t len) { if (db->error) return true; + if (len > (size_t)LONG_MAX) { + db->error = -1; + return true; + } len++; // account for the null byte - if (db->offset < len) { + if (db->offset < (long)len) { name += db->offset; len -= db->offset; db->offset = 0; |