From: martynas Date: Sat, 28 Dec 2013 01:51:53 +0000 (+0000) Subject: Annotate a few more bounded functions: realpath(3) needs a buffer X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0ad647d636da2a68f3f0c25a1c97d5e3d42368b2;p=openbsd Annotate a few more bounded functions: realpath(3) needs a buffer of size at least PATH_MAX. pread(2), pwrite(2) and readlinkat(2) also take the buffer and the bound. OK theo. --- diff --git a/include/stdlib.h b/include/stdlib.h index d50946a977e..a2310e363b7 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.55 2013/12/13 20:48:39 millert Exp $ */ +/* $OpenBSD: stdlib.h,v 1.56 2013/12/28 01:51:53 martynas Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -188,7 +188,8 @@ long random(void); char *setstate(char *); void srandom(unsigned int); -char *realpath(const char *, char *); +char *realpath(const char *, char *) + __attribute__((__bounded__ (__minbytes__,2,1024))); int setkey(const char *); diff --git a/include/unistd.h b/include/unistd.h index bc6219984d9..501f2a882dd 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.82 2013/12/04 22:58:24 deraadt Exp $ */ +/* $OpenBSD: unistd.h,v 1.83 2013/12/28 01:51:53 martynas Exp $ */ /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ /*- @@ -436,8 +436,10 @@ pid_t getsid(pid_t); #endif #if __XPG_VISIBLE >= 500 -ssize_t pread(int, void *, size_t, off_t); -ssize_t pwrite(int, const void *, size_t, off_t); +ssize_t pread(int, void *, size_t, off_t) + __attribute__((__bounded__(__buffer__,2,3))); +ssize_t pwrite(int, const void *, size_t, off_t) + __attribute__((__bounded__(__buffer__,2,3))); int ttyname_r(int, char *, size_t) __attribute__((__bounded__(__string__,2,3))); #endif @@ -468,7 +470,8 @@ int seteuid(uid_t); int faccessat(int, const char *, int, int); int fchownat(int, const char *, uid_t, gid_t, int); int linkat(int, const char *, int, const char *, int); -ssize_t readlinkat(int, const char *, char *, size_t); +ssize_t readlinkat(int, const char *, char *, size_t) + __attribute__ ((__bounded__(__string__,3,4))); int symlinkat(const char *, int, const char *); int unlinkat(int, const char *, int); #endif