Since ntfs_ucstombs() returns the output string length, there is no need
to call strlen().

Signed-off-by: Eric Biggers <ebigge...@gmail.com>
---
 libntfs-3g/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c
index f818147..fdc87fa 100644
--- a/libntfs-3g/dir.c
+++ b/libntfs-3g/dir.c
@@ -2428,11 +2428,11 @@ int ntfs_get_ntfs_dos_name(ntfs_inode *ni, ntfs_inode 
*dir_ni,
                         */
                ntfs_name_upcase(dosname, doslen,
                                ni->vol->upcase, ni->vol->upcase_len);
-               if (ntfs_ucstombs(dosname, doslen, &outname, size) < 0) {
+               outsize = ntfs_ucstombs(dosname, doslen, &outname, 0);
+               if (outsize < 0) {
                        ntfs_log_error("Cannot represent dosname in current 
locale.\n");
                        outsize = -errno;
                } else {
-                       outsize = strlen(outname);
                        if (value && (outsize <= (int)size))
                                memcpy(value, outname, outsize);
                        else
-- 
2.9.3


------------------------------------------------------------------------------
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to