summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin2015-02-25 10:31:30 +0000
committersin2015-02-25 10:31:30 +0000
commit816ad6764b842f354e46da8a5e36558fbaeeb2ad (patch)
treec9454a664a38e2ca8dd69dddc7da4dbd64b047a7
parentd8afaf63d24933f6e1706c4019155b8e09fe9d32 (diff)
Add getlogin_r() check
-rw-r--r--include/unistd.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index c2f5feb..3d27b15 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -39,6 +39,17 @@ __fortify_gethostname(char *name, size_t len)
39} 39}
40 40
41static inline __attribute__ ((always_inline)) 41static inline __attribute__ ((always_inline))
42int
43__fortify_getlogin_r(char *name, size_t len)
44{
45 size_t bos = __builtin_object_size(name, 0);
46
47 if (len > bos)
48 __builtin_trap();
49 return getlogin_r(name, len);
50}
51
52static inline __attribute__ ((always_inline))
42ssize_t 53ssize_t
43__fortify_pread(int fd, void *buf, size_t n, off_t offset) 54__fortify_pread(int fd, void *buf, size_t n, off_t offset)
44{ 55{
@@ -77,6 +88,8 @@ __fortify_write(int fd, const void *buf, size_t n)
77#define getcwd(buf, len) __fortify_getcwd(buf, len) 88#define getcwd(buf, len) __fortify_getcwd(buf, len)
78#undef gethostname 89#undef gethostname
79#define gethostname(name, len) __fortify_gethostname(name, len) 90#define gethostname(name, len) __fortify_gethostname(name, len)
91#undef getlogin_r
92#define getlogin_r(name, len) __fortify_getlogin_r(name, len)
80#undef pread 93#undef pread
81#define pread(fd, buf, n, offset) __fortify_pread(fd, buf, n, offset) 94#define pread(fd, buf, n, offset) __fortify_pread(fd, buf, n, offset)
82#undef read 95#undef read