diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-02-21 14:28:50 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-02-21 14:28:50 -0500 |
commit | 20860becb5a0e89ee2aaaddbb0ba1eb248552640 (patch) | |
tree | 499aaf0568b8805be8b05f32884cb45728a57d64 /bftw.c | |
parent | 603efbf32850335584a1b28495501fe7f77b8548 (diff) | |
download | bfs-20860becb5a0e89ee2aaaddbb0ba1eb248552640.tar.xz |
bftw: Don't store the terminating '\0' in dircache_entry names.
Diffstat (limited to 'bftw.c')
-rw-r--r-- | bftw.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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) { |