OSDN Git Service

Replace strlen with arraysize in array bounds.
authorGeorge Burgess IV <gbiv@google.com>
Wed, 25 Jan 2017 19:52:01 +0000 (11:52 -0800)
committerGeorge Burgess IV <gbiv@google.com>
Thu, 26 Jan 2017 18:35:29 +0000 (18:35 +0000)
commit36cebe7778a89fa1302a8828ade93db2d014c522
tree27f1b74b82779019650524ea6533f12f1659459a
parent24257dda488651ad2c05875761b9e9ad110975c5
Replace strlen with arraysize in array bounds.

clang-FORTIFY doesn't let us evaluate strlen("foo") as a constant
expression that can be used in static array bounds. Instead, we'd need
to either do __builtin_strlen("foo") or arraysize("foo") - 1. Just use
arraysize here, since the extra 1 byte per array isn't likely to be a
terrible thing.

Happy to swap to __builtin_strlen if anyone cares deeply enough.

Bug: 32073964
Test: Now builds with clang FORTIFY.
Change-Id: I4c9b3eb74775901554b939246722bd3a22326d10
cmds/installd/dexopt.cpp