diff options
author | Tom Cherry <tomcherry@google.com> | 2019-05-14 17:02:28 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2019-05-15 15:49:34 -0700 |
commit | c57c5bdb7f8c46e8ed8621cfdd400f6263c59197 (patch) | |
tree | b17c8c66479542bb4ece09f81ae616b3e91bf605 /libc/malloc_debug/malloc_debug.cpp | |
parent | 84c29cc446e580cdfcb3e104f8c052d57d599120 (diff) |
pwd/grp: fix pwd _r reentrancy, new tests, clean up
getpwnam_r() and getpwuid_r() clobber the storage used by getpwnam()
and getpwuid(). This isn't likely to be a big issue, but since we do
this right for the group functions, fix this as well as add a test.
Both use more space in buf than is actually required, but well below
their sysconf() suggested values, so we accept that to keep the code
concise.
Add tests for dealing with unaligned input buffers, particularly for
getgrnam_r() and getgrgid_r(), as they require alignment but this
wasn't being tested.
Refactor common initialization code for both passwd and group state
structs.
Remove extraneous null pointer checks; the values they were testing
were offsets of a previous pointer, so guaranteed to never actually be
null. If the underlying pointer is actually null, we're beyond repair
anyway, so accept that we'll crash.
Test: pwd/grp unit tests
Change-Id: I60c4d00e9ab3cf55daf8314c5029fd914025b696
Diffstat (limited to 'libc/malloc_debug/malloc_debug.cpp')
0 files changed, 0 insertions, 0 deletions