samba/samba-3.2.4-remove_strlcpy_strlcat.patch

49 lines
1.4 KiB
Diff
Raw Permalink Normal View History

diff -Nru samba-3.2.4.orig/source/client/mount.cifs.c samba-3.2.4/source/client/mount.cifs.c
--- samba-3.2.4.orig/source/client/mount.cifs.c 2008-09-18 08:49:02.000000000 +0200
+++ samba-3.2.4/source/client/mount.cifs.c 2008-10-02 12:30:24.000000000 +0200
@@ -89,44 +89,6 @@
char * domain_name = NULL;
char * prefixpath = NULL;
-/* glibc doesn't have strlcpy, strlcat. Ensure we do. JRA. We
- * don't link to libreplace so need them here. */
-
-/* like strncpy but does not 0 fill the buffer and always null
- * terminates. bufsize is the size of the destination buffer */
-static size_t strlcpy(char *d, const char *s, size_t bufsize)
-{
- size_t len = strlen(s);
- size_t ret = len;
- if (bufsize <= 0) return 0;
- if (len >= bufsize) len = bufsize-1;
- memcpy(d, s, len);
- d[len] = 0;
- return ret;
-}
-
-/* like strncat but does not 0 fill the buffer and always null
- * terminates. bufsize is the length of the buffer, which should
- * be one more than the maximum resulting string length */
-static size_t strlcat(char *d, const char *s, size_t bufsize)
-{
- size_t len1 = strlen(d);
- size_t len2 = strlen(s);
- size_t ret = len1 + len2;
-
- if (len1+len2 >= bufsize) {
- if (bufsize < (len1+1)) {
- return ret;
- }
- len2 = bufsize - (len1+1);
- }
- if (len2 > 0) {
- memcpy(d+len1, s, len2);
- d[len1+len2] = 0;
- }
- return ret;
-}
-
/* BB finish BB
cifs_umount