summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexander von Gernler <grunk@cvs.openbsd.org>2008-06-11 23:51:58 +0000
committerAlexander von Gernler <grunk@cvs.openbsd.org>2008-06-11 23:51:58 +0000
commite0facaa9d50ea6110ce45a9faca8ebdf42a985a8 (patch)
tree5cc4fc65d4ded6a8af46098ed2a3d93609ccdf21 /usr.bin
parenta5991f0bcf42c05083639a8c017acfbf46b29ebc (diff)
#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@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/key.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/key.c b/usr.bin/ssh/key.c
index 4b4dc017cc6..01e3a382eff 100644
--- a/usr.bin/ssh/key.c
+++ b/usr.bin/ssh/key.c
@@ -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():
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -315,8 +315,8 @@ key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)
* Graphs are not unambiguous, because circles in graphs can be
* walked in either direction.
*/
-#define FLDSIZE_Y 8
-#define FLDSIZE_X FLDSIZE_Y * 2
+#define FLDSIZE_Y 8
+#define FLDSIZE_X (FLDSIZE_Y * 2)
static char *
key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
{
@@ -329,7 +329,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
u_char field[FLDSIZE_X][FLDSIZE_Y];
u_int i, b;
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));
@@ -375,7 +375,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
for (y = 0; y < FLDSIZE_Y; y++) {
*p++ = '|';
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++ = '\n';
}