summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/roken
diff options
context:
space:
mode:
Diffstat (limited to 'source4/heimdal/lib/roken')
-rw-r--r--source4/heimdal/lib/roken/base64.c5
-rw-r--r--source4/heimdal/lib/roken/strpool.c5
-rw-r--r--source4/heimdal/lib/roken/vis.hin9
3 files changed, 13 insertions, 6 deletions
diff --git a/source4/heimdal/lib/roken/base64.c b/source4/heimdal/lib/roken/base64.c
index 5e720eb6d4..bc74391b56 100644
--- a/source4/heimdal/lib/roken/base64.c
+++ b/source4/heimdal/lib/roken/base64.c
@@ -58,6 +58,11 @@ base64_encode(const void *data, int size, char **str)
int c;
const unsigned char *q;
+ if (size > INT_MAX/4 || size < 0) {
+ *str = NULL;
+ return -1;
+ }
+
p = s = (char *) malloc(size * 4 / 3 + 4);
if (p == NULL) {
*str = NULL;
diff --git a/source4/heimdal/lib/roken/strpool.c b/source4/heimdal/lib/roken/strpool.c
index dc56892144..642d335dec 100644
--- a/source4/heimdal/lib/roken/strpool.c
+++ b/source4/heimdal/lib/roken/strpool.c
@@ -100,7 +100,10 @@ rk_strpoolprintf(struct rk_strpool *p, const char *fmt, ...)
char * ROKEN_LIB_FUNCTION
rk_strpoolcollect(struct rk_strpool *p)
{
- char *str = p->str;
+ char *str;
+ if (p == NULL)
+ return strdup("");
+ str = p->str;
p->str = NULL;
free(p);
return str;
diff --git a/source4/heimdal/lib/roken/vis.hin b/source4/heimdal/lib/roken/vis.hin
index 06a250c6d8..737b2eb8f6 100644
--- a/source4/heimdal/lib/roken/vis.hin
+++ b/source4/heimdal/lib/roken/vis.hin
@@ -44,6 +44,8 @@
#include <sys/types.h>
+#include <roken.h>
+
/*
* to select alternate encoding format
*/
@@ -80,11 +82,8 @@
*/
#define UNVIS_END 1 /* no more characters */
-#ifdef HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
-#endif
+ROKEN_CPP_START
-__BEGIN_DECLS
char * ROKEN_LIB_FUNCTION
rk_vis(char *, int, int, int);
char * ROKEN_LIB_FUNCTION
@@ -103,7 +102,7 @@ int ROKEN_LIB_FUNCTION
rk_strunvisx(char *, const char *, int);
int ROKEN_LIB_FUNCTION
rk_unvis(char *, int, int *, int);
-__END_DECLS
+ROKEN_CPP_END
#undef vis
#define vis(a,b,c,d) rk_vis(a,b,c,d)