From: fredrik Date: Thu, 3 Aug 2006 01:34:24 +0000 (+0000) Subject: Fix cacheput memmove bug. X-Git-Url: http://dolda2000.com/gitweb/?p=vcfs.git;a=commitdiff_plain;h=efe8eeebe84e835d36717a0ea3085d9c8084aafb;hp=ea7aa9de975de10612ca39d8b9c18ea1381fa3f1 Fix cacheput memmove bug. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/vcfs@678 959494ce-11ee-0310-bf91-de5d638817bd --- diff --git a/store.c b/store.c index 5eef6d8..b8077d3 100644 --- a/store.c +++ b/store.c @@ -48,13 +48,13 @@ static void cacheput(struct store *st, struct addr *a, const void *data, ssize_t return; if(i < 4) { tmp = st->cache[he * 4 + i]; - memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], i); + memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], i * sizeof(struct storecache)); st->cache[he * 4] = tmp; return; } if(st->cache[he * 4 + 3].data != NULL) free(st->cache[he * 4 + 3].data); - memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], 3); + memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], 3 * sizeof(struct storecache)); st->cache[he * 4].a = *a; if(len > 0) st->cache[he * 4].data = memcpy(malloc(len), data, len);