bt: don't return the address of a stack-allocated string
`char foo[] = "bar";` makes a stack-resident `char[4]`. The standard ways of getting a not-stack-allocated string are: - `const char *foo = "bar"` (`foo` will point to a `char[4]` in rodata. casting away the const here leads to badness if the string is modified.) - `static char foo[] = "bar"` (`foo` will point to a `char[4]` in a writeable section of memory that lives for the life of the program.) Since we return a non-const `char *` here, and since this method is a stub, the latter seems more appropriate. Bug: 162984360 Tag: #security Test: TreeHugger Change-Id: I51bd4a2d8e2e3826809a1bdc9743d2d1cb62870f
Loading
Please register or sign in to comment