From 20860becb5a0e89ee2aaaddbb0ba1eb248552640 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 21 Feb 2016 14:28:50 -0500 Subject: bftw: Don't store the terminating '\0' in dircache_entry names. --- bftw.c | 3 +-- 1 file changed, 1 insertion(+), 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) { -- cgit v1.2.3