diff options
Diffstat (limited to 'libglusterfs/src/store.c')
-rw-r--r-- | libglusterfs/src/store.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libglusterfs/src/store.c b/libglusterfs/src/store.c index 15a888d36c0..5172982149f 100644 --- a/libglusterfs/src/store.c +++ b/libglusterfs/src/store.c @@ -491,8 +491,10 @@ gf_store_iter_new (gf_store_handle_t *shandle, gf_store_iter_t **iter) if (!tmp_iter) goto out; - strncpy (tmp_iter->filepath, shandle->path, sizeof (tmp_iter->filepath)); - tmp_iter->filepath[sizeof (tmp_iter->filepath) - 1] = 0; + if (snprintf (tmp_iter->filepath, sizeof (tmp_iter->filepath), "%s", + shandle->path) >= sizeof (tmp_iter->filepath)) + goto out; + tmp_iter->file = fp; *iter = tmp_iter; |