summary refs log tree commit diff
path: root/socket
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2020-12-15 23:50:09 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2020-12-31 16:55:21 +0530
commitf9de8bfe1a731c309b91d175b4f6f4aeb786effa (patch)
treede1e299076d996829aacc7aecff1ae98c11a87af /socket
parent2a3224c53653214cbba2ec23424702193c80ea3b (diff)
downloadglibc-f9de8bfe1a731c309b91d175b4f6f4aeb786effa.tar.gz
glibc-f9de8bfe1a731c309b91d175b4f6f4aeb786effa.tar.xz
glibc-f9de8bfe1a731c309b91d175b4f6f4aeb786effa.zip
nonstring: Enable __FORTIFY_LEVEL=3
Use __builtin_dynamic_object_size in the remaining functions that
don't have compiler builtins as is the case for string functions.
Diffstat (limited to 'socket')
-rw-r--r--socket/bits/socket2.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h
index c0421ce244..05418ba9c3 100644
--- a/socket/bits/socket2.h
+++ b/socket/bits/socket2.h
@@ -33,13 +33,15 @@ extern ssize_t __REDIRECT (__recv_chk_warn,
 __fortify_function ssize_t
 recv (int __fd, void *__buf, size_t __n, int __flags)
 {
-  if (__bos0 (__buf) != (size_t) -1)
+  if (__glibc_objsize0 (__buf) != (size_t) -1)
     {
       if (!__builtin_constant_p (__n))
-	return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
+	return __recv_chk (__fd, __buf, __n, __glibc_objsize0 (__buf),
+			   __flags);
 
-      if (__n > __bos0 (__buf))
-	return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags);
+      if (__n > __glibc_objsize0 (__buf))
+	return __recv_chk_warn (__fd, __buf, __n, __glibc_objsize0 (__buf),
+				__flags);
     }
   return __recv_alias (__fd, __buf, __n, __flags);
 }
@@ -64,14 +66,14 @@ __fortify_function ssize_t
 recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
 	  __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
 {
-  if (__bos0 (__buf) != (size_t) -1)
+  if (__glibc_objsize0 (__buf) != (size_t) -1)
     {
       if (!__builtin_constant_p (__n))
-	return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags,
-			       __addr, __addr_len);
-      if (__n > __bos0 (__buf))
-	return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags,
-				    __addr, __addr_len);
+	return __recvfrom_chk (__fd, __buf, __n, __glibc_objsize0 (__buf),
+			       __flags, __addr, __addr_len);
+      if (__n > __glibc_objsize0 (__buf))
+	return __recvfrom_chk_warn (__fd, __buf, __n, __glibc_objsize0 (__buf),
+				    __flags, __addr, __addr_len);
     }
   return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
 }