summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJohn Kohl <jtkohl@mit.edu>1991-04-18 16:40:22 +0000
committerJohn Kohl <jtkohl@mit.edu>1991-04-18 16:40:22 +0000
commit5b4122bd1a0b95c4e09e6764e9c168b48ab833a3 (patch)
treee558a9d29da76f4033a64920eedaf97045a06a8f /src/lib
parent8e4141be132ca572d8de9725032fc3bce0560930 (diff)
downloadkrb5-5b4122bd1a0b95c4e09e6764e9c168b48ab833a3.tar.gz
krb5-5b4122bd1a0b95c4e09e6764e9c168b48ab833a3.tar.xz
krb5-5b4122bd1a0b95c4e09e6764e9c168b48ab833a3.zip
only allocate as much space as we need
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1994 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/krb5/ccache/file/fcc_gennew.c6
-rw-r--r--src/lib/krb5/ccache/stdio/scc_gennew.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/krb5/ccache/file/fcc_gennew.c b/src/lib/krb5/ccache/file/fcc_gennew.c
index 063091f13..6995605e1 100644
--- a/src/lib/krb5/ccache/file/fcc_gennew.c
+++ b/src/lib/krb5/ccache/file/fcc_gennew.c
@@ -42,7 +42,8 @@ krb5_fcc_generate_new (id)
{
krb5_ccache lid;
int ret;
- char scratch[100]; /* XXX Is this large enough */
+ char scratch[sizeof(TKT_ROOT)+6+1]; /* +6 for the scratch part, +1 for
+ NUL */
/* Allocate memory */
lid = (krb5_ccache) malloc(sizeof(struct _krb5_ccache));
@@ -51,7 +52,8 @@ krb5_fcc_generate_new (id)
lid->ops = &krb5_fcc_ops;
- sprintf(scratch, "%sXXXXXX", TKT_ROOT);
+ (void) strcpy(scratch, TKT_ROOT);
+ (void) strcat(scratch, "XXXXXX");
mktemp(scratch);
lid->data = (krb5_pointer) malloc(sizeof(krb5_fcc_data));
diff --git a/src/lib/krb5/ccache/stdio/scc_gennew.c b/src/lib/krb5/ccache/stdio/scc_gennew.c
index 42dc6d602..cbe41f5a9 100644
--- a/src/lib/krb5/ccache/stdio/scc_gennew.c
+++ b/src/lib/krb5/ccache/stdio/scc_gennew.c
@@ -42,7 +42,8 @@ krb5_scc_generate_new (id)
{
krb5_ccache lid;
FILE *f;
- char scratch[100]; /* XXX Is this large enough */
+ char scratch[sizeof(TKT_ROOT)+6+1]; /* +6 for the scratch part, +1 for
+ NUL */
/* Allocate memory */
lid = (krb5_ccache) malloc(sizeof(struct _krb5_ccache));
@@ -51,7 +52,8 @@ krb5_scc_generate_new (id)
lid->ops = &krb5_scc_ops;
- sprintf(scratch, "%sXXXXXX", TKT_ROOT);
+ (void) strcpy(scratch, TKT_ROOT);
+ (void) strcat(scratch, "XXXXXX");
mktemp(scratch);
lid->data = (krb5_pointer) malloc(sizeof(krb5_scc_data));