sbin/fsck_msdosfs: Bring in FreeBSD/Git 0d367b12 (fix LFN check)
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Thu, 12 Sep 2019 14:21:50 +0000 (23:21 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Thu, 12 Sep 2019 14:58:02 +0000 (23:58 +0900)
sbin/fsck_msdosfs/dir.c

index 3cfea04..2d81f24 100644 (file)
@@ -540,6 +540,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) {
                                        if (!p[k] && !p[k + 1])