[BugFix] tagcache/tagtree remove static buffer from tagcache_get_next

remove sizeof(buf) infavor of the actual size provided by bufsz

Change-Id: I9fc1b2ce0937526d7acbb98738c8eb1aef15683f
This commit is contained in:
William Wilgus 2023-10-06 09:17:25 -04:00
parent 2e184d129d
commit 17a8a54780

View file

@ -1921,7 +1921,7 @@ static bool get_next(struct tagcache_search *tcs, bool is_numeric, char *buf, lo
if (tcs->type == tag_filename && (flag & FLAG_DIRCACHE)) if (tcs->type == tag_filename && (flag & FLAG_DIRCACHE))
{ {
ssize_t len = dircache_get_fileref_path(&tcrc_dcfrefs[tcs->idx_id], ssize_t len = dircache_get_fileref_path(&tcrc_dcfrefs[tcs->idx_id],
buf, sizeof (buf)); buf, bufsz);
if (len >= 0) if (len >= 0)
{ {
tcs->result_len = len + 1; tcs->result_len = len + 1;
@ -1939,7 +1939,7 @@ static bool get_next(struct tagcache_search *tcs, bool is_numeric, char *buf, lo
ep = (struct tagfile_entry *)&tcramcache.hdr->tags[tcs->type][tcs->position]; ep = (struct tagfile_entry *)&tcramcache.hdr->tags[tcs->type][tcs->position];
/* don't return ep->tag_data directly as it may move */ /* don't return ep->tag_data directly as it may move */
tcs->result_len = strlcpy(buf, ep->tag_data, sizeof(buf)) + 1; tcs->result_len = strlcpy(buf, ep->tag_data, bufsz) + 1;
tcs->result = buf; tcs->result = buf;
tcs->idx_id = ep->idx_id; tcs->idx_id = ep->idx_id;
tcs->ramresult = false; /* was true before we copied to buf too */ tcs->ramresult = false; /* was true before we copied to buf too */