Browse Source

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.
OPENBSD_5_5
martynas 11 years ago
parent
commit
9af00b1d73
2 changed files with 10 additions and 6 deletions
  1. +3
    -2
      src/include/stdlib.h
  2. +7
    -4
      src/include/unistd.h

+ 3
- 2
src/include/stdlib.h View File

@ -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 *);


+ 7
- 4
src/include/unistd.h View File

@ -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


Loading…
Cancel
Save