summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util/string_wrappers.h16
-rw-r--r--lib/util/util.h12
-rw-r--r--lib/util/util_str.c71
3 files changed, 0 insertions, 99 deletions
diff --git a/lib/util/string_wrappers.h b/lib/util/string_wrappers.h
index 80d0b9932a..7baf3cb21b 100644
--- a/lib/util/string_wrappers.h
+++ b/lib/util/string_wrappers.h
@@ -52,26 +52,12 @@ size_t __unsafe_string_function_usage_here_size_t__(void);
#define nstrcpy(d,s) strlcpy((d), (s) ? (s) : "",sizeof(nstring))
#define unstrcpy(d,s) strlcpy((d), (s) ? (s) : "",sizeof(unstring))
-/* 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 */
-
#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS
/* if the compiler will optimize out function calls, then use this to tell if we are
have the correct types (this works only where sizeof() returns the size of the buffer, not
the size of the pointer). */
-#define safe_strcpy(d, s, max_len) \
- (CHECK_STRING_SIZE(d, max_len+1) \
- ? __unsafe_string_function_usage_here__() \
- : safe_strcpy_fn((d), (s), (max_len)))
-
-#define safe_strcat(d, s, max_len) \
- (CHECK_STRING_SIZE(d, max_len+1) \
- ? __unsafe_string_function_usage_here__() \
- : safe_strcat_fn((d), (s), (max_len)))
-
#define push_string_check(dest, src, dest_len, flags) \
(CHECK_STRING_SIZE(dest, dest_len) \
? __unsafe_string_function_usage_here_size_t__() \
@@ -105,8 +91,6 @@ size_t __unsafe_string_function_usage_here_size_t__(void);
#else
-#define safe_strcpy safe_strcpy_fn
-#define safe_strcat safe_strcat_fn
#define push_string_check push_string_check_fn
#define clistr_push clistr_push_fn
#define clistr_pull clistr_pull_fn
diff --git a/lib/util/util.h b/lib/util/util.h
index 45f1b9cd79..64793022c0 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -247,18 +247,6 @@ _PUBLIC_ bool trim_string(char *s, const char *front, const char *back);
_PUBLIC_ _PURE_ size_t count_chars(const char *s, char c);
/**
- Safe string copy into a known length string. maxlength does not
- include the terminating zero.
-**/
-_PUBLIC_ char *safe_strcpy_fn(char *dest,const char *src, size_t maxlength);
-
-/**
- Safe string cat into a string. maxlength does not
- include the terminating zero.
-**/
-_PUBLIC_ char *safe_strcat_fn(char *dest, const char *src, size_t maxlength);
-
-/**
Routine to get hex characters and turn them into a 16 byte array.
the array can be variable length, and any non-hex-numeric
characters are skipped. "0xnn" or "0Xnn" is specially catered
diff --git a/lib/util/util_str.c b/lib/util/util_str.c
index 9842f11653..388d7887ef 100644
--- a/lib/util/util_str.c
+++ b/lib/util/util_str.c
@@ -32,77 +32,6 @@
**/
/**
- Safe string copy into a known length string. maxlength does not
- include the terminating zero.
-**/
-
-_PUBLIC_ char *safe_strcpy_fn(char *dest,
- const char *src,
- size_t maxlength)
-{
- size_t len;
-
- if (!dest) {
- smb_panic("ERROR: NULL dest in safe_strcpy");
- }
-
- if (!src) {
- *dest = 0;
- return dest;
- }
-
- len = strnlen(src, maxlength+1);
-
- if (len > maxlength) {
- DEBUG(0,("ERROR: string overflow by "
- "%lu (%lu - %lu) in safe_strcpy [%.50s]\n",
- (unsigned long)(len-maxlength), (unsigned long)len,
- (unsigned long)maxlength, src));
- len = maxlength;
- }
-
- memmove(dest, src, len);
- dest[len] = 0;
- return dest;
-}
-
-/**
- Safe string cat into a string. maxlength does not
- include the terminating zero.
-**/
-char *safe_strcat_fn(char *dest,
- const char *src,
- size_t maxlength)
-{
- size_t src_len, dest_len;
-
- if (!dest) {
- smb_panic("ERROR: NULL dest in safe_strcat");
- }
-
- if (!src)
- return dest;
-
- src_len = strnlen(src, maxlength + 1);
- dest_len = strnlen(dest, maxlength + 1);
-
- if (src_len + dest_len > maxlength) {
- DEBUG(0,("ERROR: string overflow by %d "
- "in safe_strcat [%.50s]\n",
- (int)(src_len + dest_len - maxlength), src));
- if (maxlength > dest_len) {
- memcpy(&dest[dest_len], src, maxlength - dest_len);
- }
- dest[maxlength] = 0;
- return NULL;
- }
-
- memcpy(&dest[dest_len], src, src_len);
- dest[dest_len + src_len] = 0;
- return dest;
-}
-
-/**
format a string into length-prefixed dotted domain format, as used in NBT
and in some ADS structures
**/