lib/clobber.c

ソースコードを見る。

関数

void clobber_region (const char *fn, unsigned int line, char *dest, size_t len)
 In developer builds, clobber a region of memory.

変数

const char * global_clobber_region_function
unsigned int global_clobber_region_line


関数

void clobber_region ( const char *  fn,
unsigned int  line,
char *  dest,
size_t  len 
)

In developer builds, clobber a region of memory.

If we think a string buffer is longer than it really is, this ought to make the failure obvious, by segfaulting (if in the heap) or by killing the return address (on the stack), or by trapping under a memory debugger.

This is meant to catch possible string overflows, even if the actual string copied is not big enough to cause an overflow.

In addition, under Valgrind the buffer is marked as uninitialized.

clobber.c42 行で定義されています。

参照先 global_clobber_region_functionglobal_clobber_region_line.

参照元 alpha_strcpy_fn()cli_initialise()NewInBuffer()NewOutBuffer()pull_string_fn()push_string_fn()safe_strcat_fn()safe_strcpy_fn()smbd_process()StrnCpy_fn()strncpyn().

00043 {
00044 #ifdef DEVELOPER
00045         global_clobber_region_function = fn;
00046         global_clobber_region_line = line;
00047 
00048         /* F1 is odd and 0xf1f1f1f1 shouldn't be a valid pointer */
00049         memset(dest, 0xF1, len);
00050 #ifdef VALGRIND
00051         /* Even though we just wrote to this, from the application's
00052          * point of view it is not initialized.
00053          *
00054          * (This is not redundant with the clobbering above.  The
00055          * marking might not actually take effect if we're not running
00056          * under valgrind.) */
00057 #if defined(VALGRIND_MAKE_MEM_UNDEFINED)
00058         VALGRIND_MAKE_MEM_UNDEFINED(dest, len);
00059 #elif defined(VALGRIND_MAKE_WRITABLE)
00060         VALGRIND_MAKE_WRITABLE(dest, len);
00061 #endif
00062 #endif /* VALGRIND */
00063 #endif /* DEVELOPER */
00064 }


変数

const char* global_clobber_region_function

clobber.c25 行で定義されています。

参照元 clobber_region()smb_panic().

unsigned int global_clobber_region_line

clobber.c26 行で定義されています。

参照元 clobber_region()smb_panic().


Sambaに対してSat Aug 29 21:23:35 2009に生成されました。  doxygen 1.4.7