summaryrefslogtreecommitdiff
path: root/macros/texinfo/texinfo/gnulib/lib/vasnprintf.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-25 03:00:48 +0000
committerNorbert Preining <norbert@preining.info>2019-09-25 03:00:48 +0000
commitd232e1107d60e7689e706bee9705f26745ae8b9e (patch)
treef9ac3303fdb36c2eca1872286615c0931d952476 /macros/texinfo/texinfo/gnulib/lib/vasnprintf.c
parent94c2e367c3690be2a3c715b4577c81200652ad81 (diff)
CTAN sync 201909250300
Diffstat (limited to 'macros/texinfo/texinfo/gnulib/lib/vasnprintf.c')
-rw-r--r--macros/texinfo/texinfo/gnulib/lib/vasnprintf.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/macros/texinfo/texinfo/gnulib/lib/vasnprintf.c b/macros/texinfo/texinfo/gnulib/lib/vasnprintf.c
index c475903726..b3854e3ef9 100644
--- a/macros/texinfo/texinfo/gnulib/lib/vasnprintf.c
+++ b/macros/texinfo/texinfo/gnulib/lib/vasnprintf.c
@@ -4874,6 +4874,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
# 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';
@@ -4895,6 +4896,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
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,
@@ -4908,7 +4917,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
Windows Vista, the use of %n in format strings by default
crashes the program. See
<https://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
- <https://msdn.microsoft.com/en-us/library/ms175782.aspx>
+ <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-printf-count-output>
So we should avoid %n in this situation. */
fbp[1] = '\0';
# endif