summaryrefslogtreecommitdiff
path: root/source3/lib/slprintf.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-05-12 00:55:32 +0000
committerJeremy Allison <jra@samba.org>1998-05-12 00:55:32 +0000
commitf888868f46a5418bac9ab528497136c152895305 (patch)
treecf72c864807b19e098a856aaec8daf334189ff84 /source3/lib/slprintf.c
parent9141acecdcebd9276107a500435e3d4545020056 (diff)
downloadsamba-f888868f46a5418bac9ab528497136c152895305.tar.gz
samba-f888868f46a5418bac9ab528497136c152895305.tar.bz2
samba-f888868f46a5418bac9ab528497136c152895305.zip
This is a security audit change of the main source.
It removed all ocurrences of the following functions : sprintf strcpy strcat The replacements are slprintf, safe_strcpy and safe_strcat. It should not be possible to use code in Samba that uses sprintf, strcpy or strcat, only the safe_equivalents. Once Andrew has fixed the slprintf implementation then this code will be moved back to the 1.9.18 code stream. Jeremy. (This used to be commit 2d774454005f0b54e5684cf618da7060594dfcbb)
Diffstat (limited to 'source3/lib/slprintf.c')
-rw-r--r--source3/lib/slprintf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/lib/slprintf.c b/source3/lib/slprintf.c
index e2dc0e1235..9a00585ca8 100644
--- a/source3/lib/slprintf.c
+++ b/source3/lib/slprintf.c
@@ -41,7 +41,15 @@ int vslprintf(char *str, int n, char *format, va_list ap)
/* note: we don't free the old memory (if any) as we don't
want a malloc lib to reuse the memory as it will
have the wrong permissions */
+#ifdef HAVE_MEMALIGN
buf = memalign(pagesize, len);
+#else /* HAVE_MEMALIGN */
+#ifdef HAVE_VALLOC
+ buf = valloc(len);
+#else /* HAVE_VALLOC */
+ buf = malloc(len);
+#endif /* HAVE_VALLOC */
+#endif /* HAVE_MEMALIGN */
if (buf) {
if (mprotect(buf+(len-pagesize), pagesize, PROT_READ) != 0) {
exit(1);