Bugzilla – Attachment 2777 Details for
Bug 2520
ssh-keygen: sanitize ANSI escape sequences in key comment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
sshkeygen-sanitize-ansi-escapes.patch (text/plain), 1.42 KB, created by
Roland Hieber
on 2016-01-06 06:19:32 AEDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Roland Hieber
Created:
2016-01-06 06:19:32 AEDT
Size:
1.42 KB
patch
obsolete
>commit 5508634c070acd7e03b89b2af7d2ce28b763116d >Author: Roland Hieber <rohieb@rohieb.name> >Date: Sat Jan 2 17:53:14 2016 +0100 > > ssh-keygen: sanitize ANSI escape sequences in key comment > >diff --git a/ssh-keygen.c b/ssh-keygen.c >index c3ec4f8..a2c6bce 100644 >--- a/ssh-keygen.c >+++ b/ssh-keygen.c >@@ -37,6 +37,7 @@ > #include <string.h> > #include <unistd.h> > #include <limits.h> >+#include <bsd/vis.h> > > #include "xmalloc.h" > #include "sshkey.h" >@@ -836,6 +837,7 @@ fingerprint_one_key(const struct sshkey *public, const char *comment) > char *fp = NULL, *ra = NULL; > enum sshkey_fp_rep rep; > int fptype; >+ char * pc = NULL; > > fptype = print_bubblebabble ? SSH_DIGEST_SHA1 : fingerprint_hash; > rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT; >@@ -843,10 +845,16 @@ fingerprint_one_key(const struct sshkey *public, const char *comment) > ra = sshkey_fingerprint(public, fingerprint_hash, SSH_FP_RANDOMART); > if (fp == NULL || ra == NULL) > fatal("%s: sshkey_fingerprint failed", __func__); >+ >+ /* strvis needs 4 * strlen() according to manpage */ >+ pc = malloc(4 * strlen(comment) * sizeof (char) + 1); >+ strvis(pc, comment, VIS_OCTAL | VIS_SAFE); >+ > printf("%u %s %s (%s)\n", sshkey_size(public), fp, >- comment ? comment : "no comment", sshkey_type(public)); >+ pc ? pc : "no comment", sshkey_type(public)); > if (log_level >= SYSLOG_LEVEL_VERBOSE) > printf("%s\n", ra); >+ free(pc); > free(ra); > free(fp); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2520
:
2775
|
2776
|
2777
|
2940