From 61158ffa9a17476d88aaf4a833d13b12f1c51387 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 16 Nov 2016 22:46:48 +0000 Subject: Fix crypt snprintf namespace (bug 20829). Extending linknamespace tests to cover libcrypt showed that crypt brings in references to snprintf, but is in XPG3 and XPG4 which don't have snprintf. This patch fixes it to use __snprintf instead, exporting __snprintf from libc.so at version GLIBC_PRIVATE and adding libc_hidden_proto / libc_hidden_def accordingly. Tested for x86_64 and x86, in conjunction with the testsuite changes to enable linknamespace testing for libdl and libcrypt. Also tested (compilation only) for powerpc to make sure there were no problem interactions with the optional-long-double handling for snprintf. [BZ #20829] * stdio-common/Versions (__snprintf): Add to version GLIBC_PRIVATE. * include/stdio.h (__snprintf): Use libc_hidden_proto. * stdio-common/snprintf.c (__snprintf): Use libc_hidden_def. * crypt/sha256-crypt.c (__sha256_crypt_r): Use __snprintf instead of snprintf. * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise. --- include/stdio.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/stdio.h') diff --git a/include/stdio.h b/include/stdio.h index 1ffbc40..30e737e 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -11,6 +11,7 @@ extern int __fcloseall (void); extern int __snprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); +libc_hidden_proto (__snprintf) extern int __vsnprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, _G_va_list __arg) __attribute__ ((__format__ (__printf__, 3, 0))); -- cgit v1.1