summaryrefslogtreecommitdiff
path: root/lib/util/util_str.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-05-03 16:43:27 -0700
committerJeremy Allison <jra@samba.org>2011-05-04 22:14:14 +0200
commitff215f5c89c91a22c910400c8ac81d82d7459ba0 (patch)
treef94e9884bc1058e0726f676371c45df3ccdb3747 /lib/util/util_str.c
parent8380835fc6de38706d9af29dc7f0fa4cec4f9c90 (diff)
downloadsamba-ff215f5c89c91a22c910400c8ac81d82d7459ba0.tar.gz
samba-ff215f5c89c91a22c910400c8ac81d82d7459ba0.tar.bz2
samba-ff215f5c89c91a22c910400c8ac81d82d7459ba0.zip
I added them, so I get to kill them :-). Finally remove all uses of safe_strcpy and safe_strcat. Change to strlcpy, strlcat.
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed May 4 22:14:14 CEST 2011 on sn-devel-104
Diffstat (limited to 'lib/util/util_str.c')
-rw-r--r--lib/util/util_str.c71
1 files changed, 0 insertions, 71 deletions
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
**/