[key.c]
     #define statements that are not atoms need braces around them, else they
     will cause trouble in some cases.
     Also do a computation of -1 once, and not in a loop several times.
     spotted by otto@
This commit is contained in:
Darren Tucker 2008-06-13 04:45:50 +10:00
parent dcc1ab5483
commit d32b28a307
2 changed files with 12 additions and 6 deletions

View File

@ -41,6 +41,12 @@
[ssh_config.5] [ssh_config.5]
CheckHostIP set to ``fingerprint'' will display both hex and random art CheckHostIP set to ``fingerprint'' will display both hex and random art
spotted by naddy@ spotted by naddy@
- grunk@cvs.openbsd.org 2008/06/11 23:51:57
[key.c]
#define statements that are not atoms need braces around them, else they
will cause trouble in some cases.
Also do a computation of -1 once, and not in a loop several times.
spotted by otto@
20080611 20080611
- (djm) [channels.c configure.ac] - (djm) [channels.c configure.ac]
@ -4203,4 +4209,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.4973 2008/06/12 18:44:25 dtucker Exp $ $Id: ChangeLog,v 1.4974 2008/06/12 18:45:50 dtucker Exp $

10
key.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: key.c,v 1.71 2008/06/11 23:02:22 otto Exp $ */ /* $OpenBSD: key.c,v 1.72 2008/06/11 23:51:57 grunk Exp $ */
/* /*
* read_bignum(): * read_bignum():
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -319,8 +319,8 @@ key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)
* Graphs are not unambiguous, because circles in graphs can be * Graphs are not unambiguous, because circles in graphs can be
* walked in either direction. * walked in either direction.
*/ */
#define FLDSIZE_Y 8 #define FLDSIZE_Y 8
#define FLDSIZE_X FLDSIZE_Y * 2 #define FLDSIZE_X (FLDSIZE_Y * 2)
static char * static char *
key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len) key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
{ {
@ -333,7 +333,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
u_char field[FLDSIZE_X][FLDSIZE_Y]; u_char field[FLDSIZE_X][FLDSIZE_Y];
u_int i, b; u_int i, b;
int x, y; int x, y;
size_t len = strlen(augmentation_string); size_t len = strlen(augmentation_string) - 1;
retval = xcalloc(1, (FLDSIZE_X + 3) * (FLDSIZE_Y + 2)); retval = xcalloc(1, (FLDSIZE_X + 3) * (FLDSIZE_Y + 2));
@ -379,7 +379,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
for (y = 0; y < FLDSIZE_Y; y++) { for (y = 0; y < FLDSIZE_Y; y++) {
*p++ = '|'; *p++ = '|';
for (x = 0; x < FLDSIZE_X; x++) for (x = 0; x < FLDSIZE_X; x++)
*p++ = augmentation_string[MIN(field[x][y], len - 1)]; *p++ = augmentation_string[MIN(field[x][y], len)];
*p++ = '|'; *p++ = '|';
*p++ = '\n'; *p++ = '\n';
} }