diff options
author | Martin Pool <mbp@samba.org> | 2003-03-18 07:09:23 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2003-03-18 07:09:23 +0000 |
commit | a084f06fe33eb9903489763bc34c7092080a0a5e (patch) | |
tree | 7d4cbe25aade7b7fbdd8b7f7dc4eccbed7b5b39d /source3/lib/util_str.c | |
parent | 6cb8656c2601254ebd04a71cc68650edcba53869 (diff) | |
download | samba-a084f06fe33eb9903489763bc34c7092080a0a5e.tar.gz samba-a084f06fe33eb9903489763bc34c7092080a0a5e.tar.bz2 samba-a084f06fe33eb9903489763bc34c7092080a0a5e.zip |
Split "clobber" function and variables into its own file before it
grows too much larger.
(This used to be commit 4bbddbfc6a97ebb11e299aa7bd07ebebeab42c65)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r-- | source3/lib/util_str.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 3836d42872..8ef4ddade6 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -21,11 +21,6 @@ #include "includes.h" -#ifdef DEVELOPER -const char *global_clobber_region_function; -unsigned int global_clobber_region_line; -#endif - /** * Get the next token from a string, return False if none found. * Handles double-quotes. @@ -415,40 +410,6 @@ size_t count_chars(const char *s,char c) } /** - * 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. - **/ -void clobber_region(const char *fn, unsigned int line, char *dest, size_t len) -{ -#ifdef DEVELOPER - global_clobber_region_function = fn; - global_clobber_region_line = line; - - /* F1 is odd and 0xf1f1f1f1 shouldn't be a valid pointer */ - memset(dest, 0xF1, len); -#ifdef VALGRIND - /* Even though we just wrote to this, from the application's - * point of view it is not initialized. - * - * (This is not redundant with the clobbering above. The - * marking might not actually take effect if we're not running - * under valgrind.) */ - VALGRIND_MAKE_WRITABLE(dest, len); -#endif /* VALGRIND */ -#endif /* DEVELOPER */ -} - - -/** Safe string copy into a known length string. maxlength does not include the terminating zero. **/ |