Skip to content

Commit

Permalink
[sql_cacher] fix computing the useful value size
Browse files Browse the repository at this point in the history
...as the initial value may be overestimated if DOUBLE's are present
Credits for reporting go to @ovidiusas
  • Loading branch information
bogdan-iancu committed Apr 24, 2024
1 parent 6fcfc70 commit 09a7eaf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/sql_cacher/sql_cacher.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ static int insert_in_cachedb(cache_entry_t *c_entry, db_handlers_t *db_hdls,
memcpy(cdb_val.s + strs_offset, str_val.s, str_val.len);
strs_offset += str_val.len;
}
/* adjust the useful size to how much was actually written;
* The initial value could be over-estimated by get_cdb_val_size() */
cdb_val.len = strs_offset;

/* make sure the key is string */
val_type = VAL_TYPE(key);
Expand Down

0 comments on commit 09a7eaf

Please sign in to comment.