Nullability check for socket module.

Bugs: b/245972273
Test: adb shell
Change-Id: I7b6b00705ad7476fabf30727347555eeafff6eda
This commit is contained in:
zijunzhao 2023-06-13 21:14:33 +00:00 committed by Zijun Zhao
parent cf2090b962
commit 1e28d06667

View file

@ -30,15 +30,15 @@
#error "Never include this file directly; instead, include <sys/socket.h>"
#endif
extern ssize_t __sendto_chk(int, const void*, size_t, size_t, int, const struct sockaddr*,
extern ssize_t __sendto_chk(int, const void* _Nonnull, size_t, size_t, int, const struct sockaddr* _Nullable,
socklen_t) __INTRODUCED_IN(26);
ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, struct sockaddr*,
socklen_t*) __INTRODUCED_IN(21);
ssize_t __recvfrom_chk(int, void* _Nullable, size_t, size_t, int, struct sockaddr* _Nullable,
socklen_t* _Nullable) __INTRODUCED_IN(21);
#if defined(__BIONIC_FORTIFY)
__BIONIC_FORTIFY_INLINE
ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int flags, struct sockaddr* src_addr, socklen_t* addr_len)
ssize_t recvfrom(int fd, void* _Nullable const buf __pass_object_size0, size_t len, int flags, struct sockaddr* _Nullable src_addr, socklen_t* _Nullable addr_len)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
"'recvfrom' called with size bigger than buffer") {
@ -53,7 +53,7 @@ ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int fl
}
__BIONIC_FORTIFY_INLINE
ssize_t sendto(int fd, const void* const buf __pass_object_size0, size_t len, int flags, const struct sockaddr* dest_addr, socklen_t addr_len)
ssize_t sendto(int fd, const void* _Nonnull const buf __pass_object_size0, size_t len, int flags, const struct sockaddr* _Nullable dest_addr, socklen_t addr_len)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
"'sendto' called with size bigger than buffer") {
@ -68,7 +68,7 @@ ssize_t sendto(int fd, const void* const buf __pass_object_size0, size_t len, in
}
__BIONIC_FORTIFY_INLINE
ssize_t recv(int socket, void* const buf __pass_object_size0, size_t len, int flags)
ssize_t recv(int socket, void* _Nullable const buf __pass_object_size0, size_t len, int flags)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
"'recv' called with size bigger than buffer") {
@ -76,7 +76,7 @@ ssize_t recv(int socket, void* const buf __pass_object_size0, size_t len, int fl
}
__BIONIC_FORTIFY_INLINE
ssize_t send(int socket, const void* const buf __pass_object_size0, size_t len, int flags)
ssize_t send(int socket, const void* _Nonnull const buf __pass_object_size0, size_t len, int flags)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
"'send' called with size bigger than buffer") {