summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>2003-07-24 01:15:42 +0000
committerderaadt <>2003-07-24 01:15:42 +0000
commit235c27ab70fd4847379887b5eaeb7d6efb94aef2 (patch)
tree83283a2d60303710ca71eb9b616d1319a587e96c /src
parent268e0bed1c51c0a17c9840606a28b06713a40ccb (diff)
downloadopenbsd-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')
-rw-r--r--src/lib/libc/string/strcat.c11
-rw-r--r--src/lib/libc/string/strcpy.c11
2 files changed, 14 insertions, 8 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)
31static char *rcsid = "$OpenBSD: strcat.c,v 1.5 2003/06/02 20:18:38 millert Exp $"; 31static 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
40char * 45char *
41strcat(s, append) 46strcat(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
diff --git a/src/lib/libc/string/strcpy.c b/src/lib/libc/string/strcpy.c
index 229d6d03bd..e5c3d7dcbe 100644
--- a/src/lib/libc/string/strcpy.c
+++ b/src/lib/libc/string/strcpy.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: strcpy.c,v 1.5 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: strcpy.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: strcpy.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(strcpy,
42 "warning: strcpy() is almost always misused, please use strlcpy()");
43#endif
44
40char * 45char *
41strcpy(to, from) 46strcpy(char *to, const char *from)
42 register char *to;
43 register const char *from;
44{ 47{
45 char *save = to; 48 char *save = to;
46 49