1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-21 01:59:07 +03:00

Added some splint annotations from andreas.

This commit is contained in:
Tim Potter -
parent 98e97fac17
commit 60e84540fd
2 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,11 @@
#ifndef _SAFE_STRING_H
#define _SAFE_STRING_H
#ifndef _SPLINT_ /* http://www.splint.org */
/* Some macros to ensure people don't use buffer overflow vulnerable string
functions. */
#ifdef strcpy
#undef strcpy
#endif /* strcpy */
@ -36,6 +41,8 @@
#endif /* sprintf */
#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
#endif /* !_SPLINT_ */
#define pstrcpy(d,s) safe_strcpy((d), (s),sizeof(pstring)-1)
#define pstrcat(d,s) safe_strcat((d), (s),sizeof(pstring)-1)
#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)

View File

@ -193,11 +193,18 @@ typedef struct nttime_info
} NTTIME;
/* The Splint code analysis tool doesn't like immediate structures. */
#ifdef _SPLINT_ /* http://www.splint.org */
#undef HAVE_IMMEDIATE_STRUCTURES
#endif
/* the following rather strange looking definitions of NTSTATUS and WERROR
and there in order to catch common coding errors where different error types
are mixed up. This is especially important as we slowly convert Samba
from using BOOL for internal functions
*/
#if defined(HAVE_IMMEDIATE_STRUCTURES)
typedef struct {uint32 v;} NTSTATUS;
#define NT_STATUS(x) ((NTSTATUS) { x })