From c65f58a4df9958076562fc85e7274aed0f622176 Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Mon, 21 Jun 2004 22:55:05 +0000 Subject: add bounded attribute to some functions. anil tested and ok'ed --- sys/lib/libkern/funcs.h | 6 ++++-- sys/lib/libkern/libkern.h | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'sys/lib/libkern') 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); -- cgit v1.2.3