Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d395f791 authored by Dan Albert's avatar Dan Albert
Browse files

Fix an overflow found by ASAN.

Sometimes len is 0.

Change-Id: I031000188edc57663a5519b00cbbb751600d32f4
parent 4cd671e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -553,7 +553,7 @@ static int validateAttr(const String8& path, const ResTable& table,
                    String8(parser.getElementName(&len)).string(), attr);
            return ATTR_LEADING_SPACES;
        }
        if (str[len-1] == ' ') {
        if (len != 0 && str[len-1] == ' ') {
            fprintf(stderr, "%s:%d: Tag <%s> attribute %s can not end with a space.\n",
                    path.string(), parser.getLineNumber(),
                    String8(parser.getElementName(&len)).string(), attr);