diff options
-rw-r--r-- | source3/include/safe_string.h | 9 | ||||
-rw-r--r-- | source3/libsmb/clirap.c | 6 |
2 files changed, 12 insertions, 3 deletions
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 diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index f8f840abaa..24108d40f3 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -221,10 +221,10 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, p = param; SSVAL(p,0,0x68); /* api number */ p += 2; - pstrcpy(p,"WrLehDz"); + pstrcpy_base(p,"WrLehDz", param); p = skip_string(p,1); - pstrcpy(p,"B16BBDz"); + pstrcpy_base(p,"B16BBDz", param); p = skip_string(p,1); SSVAL(p,0,uLevel); @@ -233,7 +233,7 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, SIVAL(p,0,stype); p += 4; - p += push_pstring(p, workgroup); + p += push_pstring_base(p, workgroup, param); if (cli_api(cli, param, PTR_DIFF(p,param), 8, /* params, length, max */ |