+2019-01-22 Bruno Haible <bruno@clisp.org>
+
+ vasnprintf: Don't use %n on Android.
+ Reported and fix suggested by Hugo Beauzée-Luyssen <hugo@beauzee.fr> in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2018-12/msg00123.html>.
+ * lib/vasnprintf.c (VASNPRINTF): Don’t use %n on Android.
+
2019-01-22 Bruno Haible <bruno@clisp.org>
*printf: Support cross-compilation to Android.
# if ! (((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \
&& !defined __UCLIBC__) \
|| (defined __APPLE__ && defined __MACH__) \
+ || defined __ANDROID__ \
|| (defined _WIN32 && ! defined __CYGWIN__))
fbp[1] = '%';
fbp[2] = 'n';
On Mac OS X 10.13 or newer, the use of %n in format strings
in writable memory by default crashes the program, so we
should avoid it in this situation. */
+ /* On Android, we know that snprintf's return value conforms to
+ ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 and
+ gl_SNPRINTF_TRUNCATION_C99 pass.
+ Therefore we can avoid using %n in this situation.
+ Starting on 2018-03-07, the use of %n in format strings
+ produces a fatal error (see
+ <https://android.googlesource.com/platform/bionic/+/41398d03b7e8e0dfb951660ae713e682e9fc0336>),
+ so we should avoid it. */
/* On native Windows systems (such as mingw), we can avoid using
%n because:
- Although the gl_SNPRINTF_TRUNCATION_C99 test fails,