Skip to content

Commit

Permalink
Merge pull request #7 from lluuaapp/master
Browse files Browse the repository at this point in the history
Fixed calculations of string size for malloc
  • Loading branch information
grosjo authored Jan 20, 2019
2 parents 8cc015e + a98b18c commit 8d08957
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fts-backend-xapian-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ static int fts_backend_xapian_set_box(struct xapian_fts_backend *backend, struct
const char * mb;
fts_mailbox_get_guid(box, &mb );

int l=strlen(backend->path)+strlen(mb)+1;
backend->db = (char *)i_malloc((l+1)*sizeof(char));
int l=strlen(backend->path)+strlen(mb)+5; // add /db_ and \0
backend->db = (char *)i_malloc((l)*sizeof(char));
sprintf(backend->db,"%s/db_%s",backend->path,mb);

backend->box = box;
Expand Down

0 comments on commit 8d08957

Please sign in to comment.