Merge "Set __BIONIC_COMPLICATED_NULLNESS for the vsnprintf family" am: c35f7d6a84
am: a16884d29e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2566870 Change-Id: I14917ab55d76f5c1e31964a32efe5ede94743dcb Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
5fe6c00f78
2 changed files with 8 additions and 4 deletions
|
@ -143,9 +143,9 @@ int vdprintf(int __fd, const char* _Nonnull __fmt, va_list __args) __printflike(
|
|||
(defined(__cplusplus) && __cplusplus <= 201103L)
|
||||
char* _Nullable gets(char* _Nonnull __buf) __attribute__((deprecated("gets is unsafe, use fgets instead")));
|
||||
#endif
|
||||
int sprintf(char* _Nonnull __s, const char* _Nonnull __fmt, ...)
|
||||
int sprintf(char* __BIONIC_COMPLICATED_NULLNESS __s, const char* _Nonnull __fmt, ...)
|
||||
__printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf");
|
||||
int vsprintf(char* _Nonnull __s, const char* _Nonnull __fmt, va_list __args)
|
||||
int vsprintf(char* __BIONIC_COMPLICATED_NULLNESS __s, const char* _Nonnull __fmt, va_list __args)
|
||||
__printflike(2, 0) __warnattr_strict("vsprintf is often misused; please use vsnprintf");
|
||||
char* _Nullable tmpnam(char* _Nullable __s)
|
||||
__warnattr("tmpnam is unsafe, use mkstemp or tmpfile instead");
|
||||
|
@ -251,10 +251,10 @@ FILE* _Nullable freopen64(const char* _Nullable __path, const char* _Nonnull __m
|
|||
FILE* _Nullable tmpfile(void);
|
||||
FILE* _Nullable tmpfile64(void) __INTRODUCED_IN(24);
|
||||
|
||||
int snprintf(char* _Nullable __buf, size_t __size, const char* _Nonnull __fmt, ...) __printflike(3, 4);
|
||||
int snprintf(char* __BIONIC_COMPLICATED_NULLNESS __buf, size_t __size, const char* _Nonnull __fmt, ...) __printflike(3, 4);
|
||||
int vfscanf(FILE* _Nonnull __fp, const char* _Nonnull __fmt, va_list __args) __scanflike(2, 0);
|
||||
int vscanf(const char* _Nonnull __fmt , va_list __args) __scanflike(1, 0);
|
||||
int vsnprintf(char* _Nullable __buf, size_t __size, const char* _Nonnull __fmt, va_list __args) __printflike(3, 0);
|
||||
int vsnprintf(char* __BIONIC_COMPLICATED_NULLNESS __buf, size_t __size, const char* _Nonnull __fmt, va_list __args) __printflike(3, 0);
|
||||
int vsscanf(const char* _Nonnull __s, const char* _Nonnull __fmt, va_list __args) __scanflike(2, 0);
|
||||
|
||||
#define L_ctermid 1024 /* size for ctermid() */
|
||||
|
|
|
@ -670,6 +670,10 @@ TEST_F(DEATHTEST, readlinkat_fortified) {
|
|||
ASSERT_FORTIFY(readlinkat(AT_FDCWD, "/dev/null", buf, ct));
|
||||
}
|
||||
|
||||
TEST(TEST_NAME, snprintf_nullptr_valid) {
|
||||
ASSERT_EQ(10, snprintf(nullptr, 0, "0123456789"));
|
||||
}
|
||||
|
||||
extern "C" char* __strncat_chk(char*, const char*, size_t, size_t);
|
||||
extern "C" char* __strcat_chk(char*, const char*, size_t);
|
||||
|
||||
|
|
Loading…
Reference in a new issue