diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-06-26 18:35:14 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-06-26 18:35:14 +0000 |
commit | 8266dbf611a37e02c83c4da428f21a7d8c5bf801 (patch) | |
tree | ceefafa5cbc273538b74376d0e081cd83be48b84 /include/string.h | |
parent | 4f22ff20604dd441c644e14195a64eade733296f (diff) |
Mark various standard library functions with the __bounded__ attribute.
You must have an up-to-date gcc for this!
deraadt@ ok
Diffstat (limited to 'include/string.h')
-rw-r--r-- | include/string.h | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/include/string.h b/include/string.h index 371cf091279..5cf0dd09a22 100644 --- a/include/string.h +++ b/include/string.h @@ -1,4 +1,4 @@ -/* $OpenBSD: string.h,v 1.10 2003/06/02 19:34:12 millert Exp $ */ +/* $OpenBSD: string.h,v 1.11 2003/06/26 18:35:13 avsm Exp $ */ /* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ /*- @@ -54,9 +54,14 @@ typedef _BSD_SIZE_T_ size_t; __BEGIN_DECLS void *memchr(const void *, int, size_t); int memcmp(const void *, const void *, size_t); -void *memcpy(void *, const void *, size_t); -void *memmove(void *, const void *, size_t); -void *memset(void *, int, size_t); +void *memcpy(void *, const void *, size_t) + __attribute__ ((__bounded__(__buffer__,1,3))) + __attribute__ ((__bounded__(__buffer__,2,3))); +void *memmove(void *, const void *, size_t) + __attribute__ ((__bounded__(__buffer__,1,3))) + __attribute__ ((__bounded__(__buffer__,2,3))); +void *memset(void *, int, size_t) + __attribute__ ((__bounded__(__buffer__,1,3))); char *strcat(char *, const char *); char *strchr(const char *, int); int strcmp(const char *, const char *); @@ -64,32 +69,41 @@ int strcoll(const char *, const char *); char *strcpy(char *, const char *); size_t strcspn(const char *, const char *); char *strerror(int); -int strerror_r(int, char *, size_t); +int strerror_r(int, char *, size_t) + __attribute__ ((__bounded__(__string__,2,3))); size_t strlen(const char *); -char *strncat(char *, const char *, size_t); +char *strncat(char *, const char *, size_t) + __attribute__ ((__bounded__(__string__,1,3))); int strncmp(const char *, const char *, size_t); -char *strncpy(char *, const char *, size_t); +char *strncpy(char *, const char *, size_t) + __attribute__ ((__bounded__(__string__,1,3))); char *strpbrk(const char *, const char *); char *strrchr(const char *, int); size_t strspn(const char *, const char *); char *strstr(const char *, const char *); char *strtok(char *, const char *); char *strtok_r(char *, const char *, char **); -size_t strxfrm(char *, const char *, size_t); +size_t strxfrm(char *, const char *, size_t) + __attribute__ ((__bounded__(__string__,1,3))); /* Nonstandard routines */ #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) int bcmp(const void *, const void *, size_t); -void bcopy(const void *, void *, size_t); -void bzero(void *, size_t); +void bcopy(const void *, void *, size_t) + __attribute__ ((__bounded__(__buffer__,2,3))); +void bzero(void *, size_t) + __attribute__ ((__bounded__(__buffer__,1,2))); int ffs(int); char *index(const char *, int); -void *memccpy(void *, const void *, int, size_t); +void *memccpy(void *, const void *, int, size_t) + __attribute__ ((__bounded__(__buffer__,1,4))); char *rindex(const char *, int); int strcasecmp(const char *, const char *); char *strdup(const char *); -size_t strlcat(char *, const char *, size_t); -size_t strlcpy(char *, const char *, size_t); +size_t strlcat(char *, const char *, size_t) + __attribute__ ((__bounded__(__string__,1,3))); +size_t strlcpy(char *, const char *, size_t) + __attribute__ ((__bounded__(__string__,1,3))); void strmode(int, char *); int strncasecmp(const char *, const char *, size_t); char *strsep(char **, const char *); |