From 8197aca7f2110fa764c1aecd005d878d8ddd3a3c Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 12 Aug 2016 09:20:07 -0700 Subject: [PATCH] Fix recvfrom prototype. http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html Change-Id: Iba203c74045c88e53e28c2e0c8bc1f9ac63ce23e --- libc/bionic/fortify.cpp | 3 +-- libc/include/sys/socket.h | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp index 92db5d977..cf5066445 100644 --- a/libc/bionic/fortify.cpp +++ b/libc/bionic/fortify.cpp @@ -217,8 +217,7 @@ ssize_t __readlink_chk(const char* path, char* buf, size_t size, size_t buf_size } ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buf_size, - int flags, const sockaddr* src_addr, - socklen_t* addrlen) { + int flags, sockaddr* src_addr, socklen_t* addrlen) { __check_buffer_access("recvfrom", "write into", len, buf_size); return recvfrom(socket, buf, len, flags, src_addr, addrlen); } diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h index 223c3b296..6a275e47c 100644 --- a/libc/include/sys/socket.h +++ b/libc/include/sys/socket.h @@ -291,18 +291,18 @@ ssize_t send(int, const void*, size_t, int); ssize_t recv(int, void*, size_t, int); __socketcall ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t); -__socketcall ssize_t recvfrom(int, void*, size_t, int, const struct sockaddr*, socklen_t*); +__socketcall ssize_t recvfrom(int, void*, size_t, int, struct sockaddr*, socklen_t*); __errordecl(__recvfrom_error, "recvfrom called with size bigger than buffer"); -ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, const struct sockaddr*, socklen_t*) +ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, struct sockaddr*, socklen_t*) __INTRODUCED_IN(21); -ssize_t __recvfrom_real(int, void*, size_t, int, const struct sockaddr*, socklen_t*) __RENAME(recvfrom); +ssize_t __recvfrom_real(int, void*, size_t, int, struct sockaddr*, socklen_t*) __RENAME(recvfrom); #if defined(__BIONIC_FORTIFY) #if __ANDROID_API__ >= 24 __BIONIC_FORTIFY_INLINE -ssize_t recvfrom(int fd, void* buf, size_t len, int flags, const struct sockaddr* src_addr, socklen_t* addr_len) { +ssize_t recvfrom(int fd, void* buf, size_t len, int flags, struct sockaddr* src_addr, socklen_t* addr_len) { size_t bos = __bos0(buf); #if !defined(__clang__)