summaryrefslogtreecommitdiff
path: root/include/string.h
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-08-01 17:38:34 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-08-01 17:38:34 +0000
commitd68eb8fee6d53373bd6305628015b381d50e5a81 (patch)
tree1a024d606a1af2da709084dc790f2510d6665ae6 /include/string.h
parent594ac08ee4888800f45f3229059b0bcb5d56b45f (diff)
add __bounded__ attributes for userland headers; enabled with -Wbounded
ok deraadt@
Diffstat (limited to 'include/string.h')
-rw-r--r--include/string.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/include/string.h b/include/string.h
index bef70f2bc65..31e70d89369 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: string.h,v 1.12 2003/06/26 19:34:17 avsm Exp $ */
+/* $OpenBSD: string.h,v 1.13 2003/08/01 17:38:33 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 *);