- djm@cvs.openbsd.org 2014/07/03 03:34:09

[gss-serv.c session.c ssh-keygen.c]
     standardise on NI_MAXHOST for gethostname() string lengths; about
     1/2 the cases were using it already. Fixes bz#2239 en passant
This commit is contained in:
Damien Miller 2014-07-03 21:24:19 +10:00
parent c174a3b7c1
commit e5c0d52ceb
4 changed files with 12 additions and 7 deletions

View File

@ -25,6 +25,10 @@
use EVP_Digest() for one-shot hash instead of creating, updating, use EVP_Digest() for one-shot hash instead of creating, updating,
finalising and destroying a context. finalising and destroying a context.
bz#2231, based on patch from Timo Teras bz#2231, based on patch from Timo Teras
- djm@cvs.openbsd.org 2014/07/03 03:34:09
[gss-serv.c session.c ssh-keygen.c]
standardise on NI_MAXHOST for gethostname() string lengths; about
1/2 the cases were using it already. Fixes bz#2239 en passant
20140702 20140702
- OpenBSD CVS Sync - OpenBSD CVS Sync

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gss-serv.c,v 1.26 2014/02/26 20:28:44 djm Exp $ */ /* $OpenBSD: gss-serv.c,v 1.27 2014/07/03 03:34:09 djm Exp $ */
/* /*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@ -97,13 +97,13 @@ static OM_uint32
ssh_gssapi_acquire_cred(Gssctxt *ctx) ssh_gssapi_acquire_cred(Gssctxt *ctx)
{ {
OM_uint32 status; OM_uint32 status;
char lname[MAXHOSTNAMELEN]; char lname[NI_MAXHOST];
gss_OID_set oidset; gss_OID_set oidset;
gss_create_empty_oid_set(&status, &oidset); gss_create_empty_oid_set(&status, &oidset);
gss_add_oid_set_member(&status, ctx->oid, &oidset); gss_add_oid_set_member(&status, ctx->oid, &oidset);
if (gethostname(lname, MAXHOSTNAMELEN)) { if (gethostname(lname, sizeof(lname))) {
gss_release_oid_set(&status, &oidset); gss_release_oid_set(&status, &oidset);
return (-1); return (-1);
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: session.c,v 1.271 2014/03/03 22:22:30 djm Exp $ */ /* $OpenBSD: session.c,v 1.272 2014/07/03 03:34:09 djm Exp $ */
/* /*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved * All rights reserved
@ -49,6 +49,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <grp.h> #include <grp.h>
#include <netdb.h>
#ifdef HAVE_PATHS_H #ifdef HAVE_PATHS_H
#include <paths.h> #include <paths.h>
#endif #endif
@ -2653,7 +2654,7 @@ session_setup_x11fwd(Session *s)
{ {
struct stat st; struct stat st;
char display[512], auth_display[512]; char display[512], auth_display[512];
char hostname[MAXHOSTNAMELEN]; char hostname[NI_MAXHOST];
u_int i; u_int i;
if (no_x11_forwarding_flag) { if (no_x11_forwarding_flag) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-keygen.c,v 1.247 2014/06/24 01:13:21 djm Exp $ */ /* $OpenBSD: ssh-keygen.c,v 1.248 2014/07/03 03:34:09 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -165,7 +165,7 @@ int rounds = 0;
/* argv0 */ /* argv0 */
extern char *__progname; extern char *__progname;
char hostname[MAXHOSTNAMELEN]; char hostname[NI_MAXHOST];
/* moduli.c */ /* moduli.c */
int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *); int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *);