fat: use the return value of strlcpy instead of strlen.
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user