From 4e5439438c452e7153f122de2ca7428e885b4c6a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 1 Mar 2003 01:07:18 +0000 Subject: the new DEVELOPER checks for string overflows have (as expected) broken a lot of stuff. These two macros are meant to make life easier when fixing these bugs. I'm guessing we will see more macros like this (eg. fstrcpy_base) (This used to be commit 50389c0cb2504d7941ec691af21d6a20ae5c5de7) --- source3/include/safe_string.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 26bf6cdd6f..431dc400aa 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -87,4 +87,13 @@ char * __unsafe_string_function_usage_here__(void); #define strlower(s) strlower_m(s) #define strupper(s) strupper_m(s) +/* the addition of the DEVELOPER checks in safe_strcpy means we must + * update a lot of code. To make this a little easier here are some + * functions that provide the lengths with less pain */ +#define pstrcpy_base(dest, src, pstring_base) \ + safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1) + +#define push_pstring_base(dest, src, pstring_base) \ + push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE) + #endif -- cgit