libsmb: Simplify an if-condition
[Samba.git] / lib / util / safe_string.h
blobedff296f028581f061da34eaa55d443af9e23902
1 /*
2 Unix SMB/CIFS implementation.
3 Safe string handling routines.
4 Copyright (C) Andrew Tridgell 1994-1998
5 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _SAFE_STRING_H
22 #define _SAFE_STRING_H
23 #ifndef _SPLINT_ /* http://www.splint.org */
25 /* Some macros to ensure people don't use buffer overflow vulnerable string
26 functions. */
28 #ifdef bcopy
29 #undef bcopy
30 #endif /* bcopy */
31 #define bcopy(src,dest,size) __ERROR__XX__NEVER_USE_BCOPY___;
33 #ifdef strcpy
34 #undef strcpy
35 #endif /* strcpy */
36 #define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
38 #ifdef strcat
39 #undef strcat
40 #endif /* strcat */
41 #define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
43 #ifdef sprintf
44 #undef sprintf
45 #endif /* sprintf */
46 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
49 * strcasecmp/strncasecmp aren't an error, but it means you're not thinking about
50 * multibyte. Don't use them. JRA.
52 #ifdef strcasecmp
53 #undef strcasecmp
54 #endif
55 #define strcasecmp __ERROR__XX__NEVER_USE_STRCASECMP__;
57 #ifdef strncasecmp
58 #undef strncasecmp
59 #endif
60 #define strncasecmp __ERROR__XX__NEVER_USE_STRNCASECMP__;
62 #endif /* !_SPLINT_ */
64 #endif