mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
hmcdrvfs: Fix hmcdrv_path_copy()
While iterating over the string, hmcdrv_path_copy() subtracts one byte of the length to account for the NUL byte, but fails to account for the '/' character it might add. Change the test to leave two bytes of room. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Reviewed-by: Marc Hartmayer <marc@linux.ibm.com> Reviewed-by: Mete Durlu <meted@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
ee8897f9db
commit
b38d5833fa
@@ -514,7 +514,7 @@ static int hmcdrv_path_copy(struct hmcdrv_fuse_file *fp, char *dest)
|
||||
char *src = HMCDRV_FUSE_PATH(fp);
|
||||
int len = 0;
|
||||
|
||||
while ((len < (HMCDRV_FUSE_MAXPATH - 1)) &&
|
||||
while ((len < (HMCDRV_FUSE_MAXPATH - 2)) &&
|
||||
(*src != '\0')) {
|
||||
|
||||
*dest = *src;
|
||||
|
||||
Reference in New Issue
Block a user