diff options
author | Xin LI <delphij@FreeBSD.org> | 2019-06-11 22:21:29 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2019-06-11 22:21:29 +0000 |
commit | bf6ed41692a49bcbe70ab0629cfc5d207c78544c (patch) | |
tree | 90bb68dd2f00fef1e2e34320bfad33fbbde6d208 /sbin/fsck_msdosfs | |
parent | 77a0144145d8913221a2c71d9060a08665491539 (diff) | |
download | src-bf6ed41692a49bcbe70ab0629cfc5d207c78544c.tar.gz src-bf6ed41692a49bcbe70ab0629cfc5d207c78544c.zip |
Avoid out of boundary access when checking invalid long filenames.
Obtained from: OpenBSD (dir.c,v 1.25)
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=348967
Diffstat (limited to 'sbin/fsck_msdosfs')
-rw-r--r-- | sbin/fsck_msdosfs/dir.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c index e59536f6b5fc..e56bbf80c6bf 100644 --- a/sbin/fsck_msdosfs/dir.c +++ b/sbin/fsck_msdosfs/dir.c @@ -629,6 +629,15 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat, vallfn = NULL; } lidx = *p & LRNOMASK; + if (lidx == 0) { + pwarn("invalid long name\n"); + if (!invlfn) { + invlfn = vallfn; + invcl = valcl; + } + vallfn = NULL; + continue; + } t = longName + --lidx * 13; for (k = 1; k < 11 && t < longName + sizeof(longName); k += 2) { |