diff --git a/widget/gonk/libdisplay/BootAnimation.cpp b/widget/gonk/libdisplay/BootAnimation.cpp
--- a/widget/gonk/libdisplay/BootAnimation.cpp
+++ b/widget/gonk/libdisplay/BootAnimation.cpp
@@ -248,18 +248,27 @@ struct AnimationFrame {
     }
 
     void ReadPngFrame(int outputFormat);
 };
 
 struct AnimationPart {
     int32_t count;
     int32_t pause;
+    // If you alter the size of the path, change ReadFromString() as well.
     char path[256];
     vector<AnimationFrame> frames;
+
+    bool
+    ReadFromString(const char* aLine)
+    {
+        MOZ_ASSERT(aLine);
+        // this 255 value must be in sync with AnimationPart::path.
+        return sscanf(aLine, "p %d %d %255s", &count, &pause, path) == 3;
+    }
 };
 
 struct RawReadState {
     const char *start;
     uint32_t offset;
     uint32_t length;
 };
 
@@ -570,18 +579,17 @@ AnimationThread(void *)
 
     do {
         end = strstr(line, "\n");
 
         AnimationPart part;
         if (headerRead &&
             sscanf(line, "%d %d %d", &width, &height, &fps) == 3) {
             headerRead = false;
-        } else if (sscanf(line, "p %d %d %s",
-                          &part.count, &part.pause, part.path)) {
+        } else if (part.ReadFromString(line)) {
             parts.push_back(part);
         }
     } while (end && *(line = end + 1));
 
     for (uint32_t i = 0; i < parts.size(); i++) {
         AnimationPart &part = parts[i];
         entry = nullptr;
         char search[256];
