summaryrefslogtreecommitdiff
path: root/include/unistd.h
diff options
context:
space:
mode:
authorsin2015-02-28 11:52:02 +0000
committersin2015-02-28 11:52:02 +0000
commit60a707681655d249af66cec6786a6fad8337b49c (patch)
treee7568362ca1fc0e7cc07b7385e41ba2eaea47b2b /include/unistd.h
parent74ab2844967648a4e618467237480c6aba37b166 (diff)
Add getdomainname() check
Diffstat (limited to 'include/unistd.h')
-rw-r--r--include/unistd.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 3d27b15..b193a7f 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -27,6 +27,19 @@ __fortify_getcwd(char *buf, size_t len)
27 return getcwd(buf, len); 27 return getcwd(buf, len);
28} 28}
29 29
30#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
31static inline __attribute__ ((always_inline))
32int
33__fortify_getdomainname(char *name, size_t len)
34{
35 size_t bos = __builtin_object_size(name, 0);
36
37 if (len > bos)
38 __builtin_trap();
39 return getdomainname(name, len);
40}
41#endif
42
30static inline __attribute__ ((always_inline)) 43static inline __attribute__ ((always_inline))
31int 44int
32__fortify_gethostname(char *name, size_t len) 45__fortify_gethostname(char *name, size_t len)
@@ -86,6 +99,12 @@ __fortify_write(int fd, const void *buf, size_t n)
86#define confstr(name, buf, len) __fortify_confstr(name, buf, len) 99#define confstr(name, buf, len) __fortify_confstr(name, buf, len)
87#undef getcwd 100#undef getcwd
88#define getcwd(buf, len) __fortify_getcwd(buf, len) 101#define getcwd(buf, len) __fortify_getcwd(buf, len)
102
103#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
104#undef getdomainname
105#define getdomainname(name, len) __fortify_getdomainname(name, len)
106#endif
107
89#undef gethostname 108#undef gethostname
90#define gethostname(name, len) __fortify_gethostname(name, len) 109#define gethostname(name, len) __fortify_gethostname(name, len)
91#undef getlogin_r 110#undef getlogin_r