/* Check to see if it's in the inode cache */
for (i = 0; i < fs->icache->cache_size; i++) {
if (fs->icache->cache[i].ino == ino) {
- memcpy(inode, fs->icache->cache[i].inode, bufsize);
+ memcpy(inode, fs->icache->cache[i].inode,
+ (bufsize > length) ? length : bufsize);
return 0;
}
}
/* Update the inode cache bookkeeping */
fs->icache->cache_last = cache_slot;
fs->icache->cache[cache_slot].ino = ino;
- memcpy(inode, iptr, bufsize);
+ memcpy(inode, iptr, (bufsize > length) ? length : bufsize);
return 0;
}
for (i=0; i < fs->icache->cache_size; i++) {
if (fs->icache->cache[i].ino == ino) {
memcpy(fs->icache->cache[i].inode, inode,
- bufsize);
+ (bufsize > length) ? length : bufsize);
break;
}
}