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

Skip to content
Commit b18b8fd7 authored by George Burgess IV's avatar George Burgess IV
Browse files

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
parent 3c19d92f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment