diff options
author | Elliott Hughes <enh@google.com> | 2018-09-06 10:42:40 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2018-09-06 10:42:40 -0700 |
commit | f340a56d1c7aa469ccb4150521aba19f5c73dcf0 (patch) | |
tree | cc41e09773b753e85fb7a503cd257cf808fea7c0 /libc/stdio/vfwprintf.cpp | |
parent | 74934aaf10d629de477095f0b92c467849f89638 (diff) |
Use strerror_r(3) for the printf family %m.
There's TLS space used for unknown errno values, and a call to printf
shouldn't clobber that. No-one will ever hit this in real life, but
since it's easily fixed...
Bug: http://b/112776560
Test: ran tests
Change-Id: I8c2437f2e5214e652119791d4e162a197b049d5b
Diffstat (limited to 'libc/stdio/vfwprintf.cpp')
-rw-r--r-- | libc/stdio/vfwprintf.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/stdio/vfwprintf.cpp b/libc/stdio/vfwprintf.cpp index 19cce17e6..dd51eec4a 100644 --- a/libc/stdio/vfwprintf.cpp +++ b/libc/stdio/vfwprintf.cpp @@ -439,7 +439,8 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) { __fortify_fatal("%%n not allowed on Android"); case 'm': free(convbuf); - convbuf = helpers::mbsconv(strerror(caller_errno), prec); + convbuf = helpers::mbsconv(strerror_r(caller_errno, + reinterpret_cast<char*>(buf), sizeof(buf)), prec); if (convbuf == nullptr) { fp->_flags |= __SERR; goto error; |