summaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-05-09 17:41:30 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-09 17:41:30 +0200
commita063ff1e43833559efff0ef782deb464a803644b (patch)
tree39c0fb3b42d031e73da26ab56a4bc75333ebc37c /fs/isofs
parent9p: switch to ->iterate_shared() (diff)
parentget_rock_ridge_filename(): handle malformed NM entries (diff)
downloadlinux-a063ff1e43833559efff0ef782deb464a803644b.tar.xz
linux-a063ff1e43833559efff0ef782deb464a803644b.zip
Merge branch 'for-linus' into work.lookups
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/rock.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 5384ceb35b1c..98b3eb7d8eaf 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -203,6 +203,8 @@ int get_rock_ridge_filename(struct iso_directory_record *de,
int retnamlen = 0;
int truncate = 0;
int ret = 0;
+ char *p;
+ int len;
if (!ISOFS_SB(inode->i_sb)->s_rock)
return 0;
@@ -267,12 +269,17 @@ repeat:
rr->u.NM.flags);
break;
}
- if ((strlen(retname) + rr->len - 5) >= 254) {
+ len = rr->len - 5;
+ if (retnamlen + len >= 254) {
truncate = 1;
break;
}
- strncat(retname, rr->u.NM.name, rr->len - 5);
- retnamlen += rr->len - 5;
+ p = memchr(rr->u.NM.name, '\0', len);
+ if (unlikely(p))
+ len = p - rr->u.NM.name;
+ memcpy(retname + retnamlen, rr->u.NM.name, len);
+ retnamlen += len;
+ retname[retnamlen] = '\0';
break;
case SIG('R', 'E'):
kfree(rs.buffer);