From 79fa1fd854eaf9e1b3f5d33b85b73043dc83cb03 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 10 May 2003 21:44:54 +0000 Subject: warn for strcpy|strcat|sprintf|vsprintf; ok art dhartmei pval, and either henning or pb, i cannot tell which it was --- sys/lib/libkern/strcat.c | 6 ++++-- sys/lib/libkern/strcpy.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'sys/lib/libkern') diff --git a/sys/lib/libkern/strcat.c b/sys/lib/libkern/strcat.c index a493de8935a..477bb2d1d3a 100644 --- a/sys/lib/libkern/strcat.c +++ b/sys/lib/libkern/strcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcat.c,v 1.4 1998/06/27 01:21:04 mickey Exp $ */ +/* $OpenBSD: strcat.c,v 1.5 2003/05/10 21:44:53 deraadt Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -35,7 +35,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)strcat.c 5.6 (Berkeley) 2/24/91";*/ -static char *rcsid = "$OpenBSD: strcat.c,v 1.4 1998/06/27 01:21:04 mickey Exp $"; +static char *rcsid = "$OpenBSD: strcat.c,v 1.5 2003/05/10 21:44:53 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #if !defined(_KERNEL) && !defined(_STANDALONE) @@ -44,6 +44,8 @@ static char *rcsid = "$OpenBSD: strcat.c,v 1.4 1998/06/27 01:21:04 mickey Exp $" #include #endif +__warn_references(sprintf, "warning: strcat() is often misused, please use strlcpy()"); + char * strcat(s, append) register char *s; diff --git a/sys/lib/libkern/strcpy.c b/sys/lib/libkern/strcpy.c index 7febef7de96..be82b0a1218 100644 --- a/sys/lib/libkern/strcpy.c +++ b/sys/lib/libkern/strcpy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcpy.c,v 1.4 1998/06/27 01:21:07 mickey Exp $ */ +/* $OpenBSD: strcpy.c,v 1.5 2003/05/10 21:44:53 deraadt Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -35,7 +35,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)strcpy.c 5.7 (Berkeley) 2/24/91";*/ -static char *rcsid = "$OpenBSD: strcpy.c,v 1.4 1998/06/27 01:21:07 mickey Exp $"; +static char *rcsid = "$OpenBSD: strcpy.c,v 1.5 2003/05/10 21:44:53 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #if !defined(_KERNEL) && !defined(_STANDALONE) @@ -44,6 +44,8 @@ static char *rcsid = "$OpenBSD: strcpy.c,v 1.4 1998/06/27 01:21:07 mickey Exp $" #include #endif +__warn_references(sprintf, "warning: strcpy() is often misused, please use strlcpy()"); + char * strcpy(to, from) register char *to; -- cgit v1.2.3