fat: use the return value of strlcpy instead of strlen.

This commit is contained in:
Jérôme Duval
2018-04-24 19:54:00 +02:00
parent e3becd53ee
commit b0bcd96bd7
+4 -2
View File
@@ -233,11 +233,13 @@ dosfs_read_attr(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,
return EINVAL; return EINVAL;
} }
if (user_strlcpy(buffer, node->mime + pos, *_length) < B_OK) { ssize_t length = user_strlcpy(buffer, node->mime + pos, *_length);
if (length < B_OK) {
UNLOCK_VOL(vol); UNLOCK_VOL(vol);
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
} }
*_length = strlen(buffer) + 1; if (length < *_length)
*_length = length + 1;
UNLOCK_VOL(vol); UNLOCK_VOL(vol);
return 0; return 0;