From 017cb4cb15fbaa04825ba106e805a87a1d5ff78c Mon Sep 17 00:00:00 2001 From: John Franklin Date: Sat, 27 Apr 2019 20:04:56 -0500 Subject: [PATCH] Handle trailing newline in keyfile. --- vere/sist.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vere/sist.c b/vere/sist.c index 4a0d1f2966..72e7159915 100644 --- a/vere/sist.c +++ b/vere/sist.c @@ -1359,6 +1359,22 @@ u3_sist_boot(void) if ( 0 != u3_Host.ops_u.key_c ) { u3_noun des = u3m_file(u3_Host.ops_u.key_c); + + // handle trailing newline + // + { + c3_c* key_c = u3r_string(des); + c3_w len_w = strlen(key_c); + + if (len_w && (key_c[len_w - 1] == '\n')) { + key_c[len_w - 1] = '\0'; + u3z(des); + des = u3i_string(key_c); + } + + free(key_c); + } + sed = sist_key(des); } else if ( 0 != u3_Host.ops_u.gen_c ) {