diff options
author | 2006-04-03 07:10:38 +0000 | |
---|---|---|
committer | 2006-04-03 07:10:38 +0000 | |
commit | 6169f5bc0f8fe2e7d505ad25b10a1ff1c856aed5 (patch) | |
tree | 80b59dc7e6c897fd692431eb38daa7c91b359009 | |
parent | lint, strtonum() (diff) | |
download | wireguard-openbsd-6169f5bc0f8fe2e7d505ad25b10a1ff1c856aed5.tar.xz wireguard-openbsd-6169f5bc0f8fe2e7d505ad25b10a1ff1c856aed5.zip |
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@
-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))) |