diff options
author | deraadt <> | 2003-07-24 01:15:42 +0000 |
---|---|---|
committer | deraadt <> | 2003-07-24 01:15:42 +0000 |
commit | 235c27ab70fd4847379887b5eaeb7d6efb94aef2 (patch) | |
tree | 83283a2d60303710ca71eb9b616d1319a587e96c /src/lib/libc/string/strcat.c | |
parent | 268e0bed1c51c0a17c9840606a28b06713a40ccb (diff) | |
download | openbsd-235c27ab70fd4847379887b5eaeb7d6efb94aef2.tar.gz openbsd-235c27ab70fd4847379887b5eaeb7d6efb94aef2.tar.bz2 openbsd-235c27ab70fd4847379887b5eaeb7d6efb94aef2.zip |
warn about unsafe APIs at link time. Conditional on libc/Makefile defining
APIWARN; disabled by default. In use by many developers for quite some time,
now they have a common knob to enable/disable this
Diffstat (limited to 'src/lib/libc/string/strcat.c')
-rw-r--r-- | src/lib/libc/string/strcat.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libc/string/strcat.c b/src/lib/libc/string/strcat.c index 05a517a38b..885822bae3 100644 --- a/src/lib/libc/string/strcat.c +++ b/src/lib/libc/string/strcat.c | |||
@@ -28,7 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #if defined(LIBC_SCCS) && !defined(lint) | 30 | #if defined(LIBC_SCCS) && !defined(lint) |
31 | static char *rcsid = "$OpenBSD: strcat.c,v 1.5 2003/06/02 20:18:38 millert Exp $"; | 31 | static char *rcsid = "$OpenBSD: strcat.c,v 1.6 2003/07/24 01:15:42 deraadt Exp $"; |
32 | #endif /* LIBC_SCCS and not lint */ | 32 | #endif /* LIBC_SCCS and not lint */ |
33 | 33 | ||
34 | #ifndef _KERNEL | 34 | #ifndef _KERNEL |
@@ -37,10 +37,13 @@ static char *rcsid = "$OpenBSD: strcat.c,v 1.5 2003/06/02 20:18:38 millert Exp $ | |||
37 | #include <lib/libkern/libkern.h> | 37 | #include <lib/libkern/libkern.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #if defined(APIWARN) | ||
41 | __warn_references(strcat, | ||
42 | "warning: strcat() is almost always misused, please use strlcat()"); | ||
43 | #endif | ||
44 | |||
40 | char * | 45 | char * |
41 | strcat(s, append) | 46 | strcat(char *s, const char *append) |
42 | register char *s; | ||
43 | register const char *append; | ||
44 | { | 47 | { |
45 | char *save = s; | 48 | char *save = s; |
46 | 49 | ||