mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cmsfs-fuse: Fix strip_right() function
strip_right() strips spaces beginning at the end of the string moving to the beginning. However, it doesn't check whether it's at beginning of the array, and would continue reading if the string only contains spaces. Fix this by adding the necessary check. Signed-off-by: Sven Schnelle <svens@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
b38d5833fa
commit
162a041077
@@ -713,7 +713,7 @@ static int readdir_entry(struct fst_entry *fst, off_t addr)
|
||||
*/
|
||||
static inline int strip_right(const char *str, int size)
|
||||
{
|
||||
while (str[size - 1] == 0x20)
|
||||
while (size > 0 && str[size - 1] == 0x20)
|
||||
size--;
|
||||
return size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user