fat: dosfs_read_attr used the user buffer directly

It now uses user_strlcpy().
This commit is contained in:
Jérôme Duval
2018-04-07 17:53:47 +02:00
parent fbc298d331
commit 509c7718dd
+4 -2
View File
@@ -233,8 +233,10 @@ dosfs_read_attr(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,
return EINVAL;
}
strncpy(buffer, node->mime + pos, *_length - 1);
((char *)buffer)[*_length - 1] = 0;
if (user_strlcpy(buffer, node->mime + pos, *_length) < B_OK) {
UNLOCK_VOL(vol);
return B_BAD_ADDRESS;
}
*_length = strlen(buffer) + 1;
UNLOCK_VOL(vol);