summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-06-21 22:55:05 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-06-21 22:55:05 +0000
commitc65f58a4df9958076562fc85e7274aed0f622176 (patch)
tree361a1cb4beb62787b9fc00cae3df68e42ff7deb3
parentd0f1e78e8caefac97f642f08eb3dcfa765894346 (diff)
add bounded attribute to some functions. anil tested and ok'ed
-rw-r--r--sys/lib/libkern/funcs.h6
-rw-r--r--sys/lib/libkern/libkern.h11
2 files changed, 11 insertions, 6 deletions
diff --git a/sys/lib/libkern/funcs.h b/sys/lib/libkern/funcs.h
index 9312dfb7d8a..b2cd0692f53 100644
--- a/sys/lib/libkern/funcs.h
+++ b/sys/lib/libkern/funcs.h
@@ -1,2 +1,4 @@
-size_t strlcpy(char *, const char *, int);
-size_t strlcat(char *, const char *, int);
+size_t strlcpy(char *, const char *, int)
+ __attribute__ ((__bounded__(__string__,1,3)));
+size_t strlcat(char *, const char *, int)
+ __attribute__ ((__bounded__(__string__,1,3)));
diff --git a/sys/lib/libkern/libkern.h b/sys/lib/libkern/libkern.h
index 1acf6bf8775..ef16334295b 100644
--- a/sys/lib/libkern/libkern.h
+++ b/sys/lib/libkern/libkern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: libkern.h,v 1.20 2004/05/06 01:12:05 deraadt Exp $ */
+/* $OpenBSD: libkern.h,v 1.21 2004/06/21 22:55:04 itojun Exp $ */
/* $NetBSD: libkern.h,v 1.7 1996/03/14 18:52:08 christos Exp $ */
/*-
@@ -160,9 +160,12 @@ void srandom(u_long);
int scanc(u_int, const u_char *, const u_char *, int);
int skpc(int, size_t, u_char *);
size_t strlen(const char *);
-char *strncpy(char *, const char *, size_t);
-size_t strlcpy(char *, const char *, size_t);
-size_t strlcat(char *, const char *, size_t);
+char *strncpy(char *, const char *, size_t)
+ __attribute__ ((__bounded__(__string__,1,3)));
+size_t strlcpy(char *, const char *, size_t)
+ __attribute__ ((__bounded__(__string__,1,3)));
+size_t strlcat(char *, const char *, size_t)
+ __attribute__ ((__bounded__(__string__,1,3)));
int strcmp(const char *, const char *);
int strncmp(const char *, const char *, size_t);
int strncasecmp(const char *, const char *, size_t);