summaryrefslogtreecommitdiffstats
path: root/gss-genr.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-04-23 04:05:46 +0200
committerDamien Miller <djm@mindrot.org>2006-04-23 04:05:46 +0200
commit63e437f053bec9e227ba11e5e6205cd1e217baac (patch)
treef910de559e1371216947f027a88a9c164a16f40e /gss-genr.c
parent - dtucker@cvs.openbsd.org 2006/04/02 08:34:52 (diff)
downloadopenssh-63e437f053bec9e227ba11e5e6205cd1e217baac.tar.xz
openssh-63e437f053bec9e227ba11e5e6205cd1e217baac.zip
- djm@cvs.openbsd.org 2006/04/03 07:10:38
[gss-genr.c] GSSAPI buffers shouldn't be nul-terminated, spotted in bugzilla #1066 by dleonard AT vintela.com. use xasprintf() to simplify code while in there; "looks right" deraadt@
Diffstat (limited to 'gss-genr.c')
-rw-r--r--gss-genr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gss-genr.c b/gss-genr.c
index 4c10f1aab..3d630ab82 100644
--- a/gss-genr.c
+++ b/gss-genr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gss-genr.c,v 1.9 2006/03/25 22:22:43 djm Exp $ */
+/* $OpenBSD: gss-genr.c,v 1.10 2006/04/03 07:10:38 djm Exp $ */
/*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -205,10 +205,11 @@ OM_uint32
ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
{
gss_buffer_desc gssbuf;
+ char *val;
- gssbuf.length = sizeof("host@") + strlen(host);
- gssbuf.value = xmalloc(gssbuf.length);
- snprintf(gssbuf.value, gssbuf.length, "host@%s", host);
+ xasprintf(&val, "host@%s", host);
+ gssbuf.value = val;
+ gssbuf.length = strlen(gssbuf.value);
if ((ctx->major = gss_import_name(&ctx->minor,
&gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name)))