View | Details | Raw Unified | Return to bug 2247 | Differences between
and this patch

Collapse All | Expand All

(-)sshkey.c (-7 / +16 lines)
Lines 1002-1012 fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len, Link Here
1002
	 * intersects with itself.  Matter of taste.
1002
	 * intersects with itself.  Matter of taste.
1003
	 */
1003
	 */
1004
	char	*augmentation_string = " .o+=*BOX@%&#/^SE";
1004
	char	*augmentation_string = " .o+=*BOX@%&#/^SE";
1005
	char	*retval, *p;
1005
	char	*retval, *p, title[FLDSIZE_X];
1006
	u_char	 field[FLDSIZE_X][FLDSIZE_Y];
1006
	u_char	 field[FLDSIZE_X][FLDSIZE_Y];
1007
	size_t	 i;
1007
	size_t	 i, tlen;
1008
	u_int	 b;
1008
	u_int	 b;
1009
	int	 x, y;
1009
	int	 x, y, r;
1010
	size_t	 len = strlen(augmentation_string) - 1;
1010
	size_t	 len = strlen(augmentation_string) - 1;
1011
1011
1012
	if ((retval = calloc((FLDSIZE_X + 3), (FLDSIZE_Y + 2))) == NULL)
1012
	if ((retval = calloc((FLDSIZE_X + 3), (FLDSIZE_Y + 2))) == NULL)
Lines 1044-1055 fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len, Link Here
1044
	field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1;
1044
	field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1;
1045
	field[x][y] = len;
1045
	field[x][y] = len;
1046
1046
1047
	/* fill in retval */
1047
	/* assemble title */
1048
	snprintf(retval, FLDSIZE_X, "+--[%4s %4u]",
1048
	r = snprintf(title, sizeof(title), "[%s %u]",
1049
	    sshkey_type(k), sshkey_size(k));
1049
		sshkey_type(k), sshkey_size(k));
1050
	p = strchr(retval, '\0');
1050
	/* If [type size] won't fit, then try [type]; fits "[ED25519-CERT]" */
1051
	if (r < 0 || r > (int)sizeof(title))
1052
		snprintf(title, sizeof(title), "[%s]", sshkey_type(k));
1053
	tlen = strlen(title);
1051
1054
1052
	/* output upper border */
1055
	/* output upper border */
1056
	p = retval;
1057
	*p++ = '+';
1058
	for (i = 0; i < (FLDSIZE_X - tlen) / 2; i++)
1059
		*p++ = '-';
1060
	memcpy(p, title, tlen);
1061
	p += tlen;
1053
	for (i = p - retval - 1; i < FLDSIZE_X; i++)
1062
	for (i = p - retval - 1; i < FLDSIZE_X; i++)
1054
		*p++ = '-';
1063
		*p++ = '-';
1055
	*p++ = '+';
1064
	*p++ = '+';

Return to bug 2247