OSDN Git Service

Check max continuations count when reading file entry.
authorresver@gmail.com <resver@gmail.com@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sat, 3 Aug 2013 08:42:58 +0000 (08:42 +0000)
committerresver@gmail.com <resver@gmail.com@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sat, 3 Aug 2013 08:42:58 +0000 (08:42 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@370 60bc1c72-a15a-11de-b98f-4500b42dc123

libexfat/node.c

index a154682..9eaf0d7 100644 (file)
@@ -218,6 +218,12 @@ static int readdir(struct exfat* ef, const struct exfat_node* parent,
                                exfat_error("too few continuations (%hhu)", continuations);
                                goto error;
                        }
+                       if (continuations > 1 +
+                                       DIV_ROUND_UP(EXFAT_NAME_MAX, EXFAT_ENAME_MAX))
+                       {
+                               exfat_error("too many continuations (%hhu)", continuations);
+                               goto error;
+                       }
                        reference_checksum = le16_to_cpu(meta1->checksum);
                        actual_checksum = exfat_start_checksum(meta1);
                        *node = allocate_node();