summaryrefslogtreecommitdiffstats
path: root/bftw.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-21 14:28:50 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-21 14:28:50 -0500
commit20860becb5a0e89ee2aaaddbb0ba1eb248552640 (patch)
tree499aaf0568b8805be8b05f32884cb45728a57d64 /bftw.c
parent603efbf32850335584a1b28495501fe7f77b8548 (diff)
downloadbfs-20860becb5a0e89ee2aaaddbb0ba1eb248552640.tar.xz
bftw: Don't store the terminating '\0' in dircache_entry names.
Diffstat (limited to 'bftw.c')
-rw-r--r--bftw.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/bftw.c b/bftw.c
index f934f91..7ad36a6 100644
--- a/bftw.c
+++ b/bftw.c
@@ -244,7 +244,7 @@ static void dircache_pop(struct dircache *cache, struct dircache_entry *entry) {
/** Add an entry to the dircache. */
static struct dircache_entry *dircache_add(struct dircache *cache, struct dircache_entry *parent, const char *name) {
size_t namelen = strlen(name);
- size_t size = sizeof(struct dircache_entry) + namelen + 1;
+ size_t size = sizeof(struct dircache_entry) + namelen;
bool needs_slash = false;
if (namelen == 0 || name[namelen - 1] != '/') {
@@ -274,7 +274,6 @@ static struct dircache_entry *dircache_add(struct dircache *cache, struct dircac
if (needs_slash) {
entry->name[namelen++] = '/';
}
- entry->name[namelen] = '\0';
entry->namelen = namelen;
while (parent) {