diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2006-04-03 07:10:39 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2006-04-03 07:10:39 +0000 |
commit | 9d778a0b2561c51cc45fa1218a75f75d8e0f7057 (patch) | |
tree | 5423496a0fd9ecf57dcdcf379edbe97c3f3965ed /usr.bin/ssh/gss-genr.c | |
parent | c77233607f0dd74f875c8feda10801886e4f87ac (diff) |
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 'usr.bin/ssh/gss-genr.c')
-rw-r--r-- | usr.bin/ssh/gss-genr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/ssh/gss-genr.c b/usr.bin/ssh/gss-genr.c index 4c10f1aab3b..3d630ab822b 100644 --- a/usr.bin/ssh/gss-genr.c +++ b/usr.bin/ssh/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))) |