tTrim trailing LF from base64 signatures - sick - sign and check files using ed25519
(HTM) git clone git://z3bra.org/sick
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 4db5b23df9c2def4e1316c4db4ec082a227c3412
(DIR) parent b48608a67e36deca673c3f5792886773bdba9ae4
(HTM) Author: Willy Goiffon <contact@z3bra.org>
Date: Thu, 10 Aug 2023 17:35:20 +0200
Trim trailing LF from base64 signatures
Diffstat:
M sick.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/sick.c b/sick.c
t@@ -172,10 +172,11 @@ extractsig(unsigned char **sig, char *buf, size_t len)
* black magic pointer arithmetic there..
* if we reached the "end" pointer, it means we're at the end
* of the signature.
- * The line length is either 76 bytes long, or less (for the
- * last line)
+ * The line length is either 76 bytes long, or less for the
+ * last line. In the latter case, the trailing \n must be
+ * trimmed before decoding.
*/
- n = begin+i+76 < end ? 76 : end - (begin + i);
+ n = begin+i+76 < end ? 76 : end - (begin + i) - 1;
memset(base64, 0, 76);
memcpy(base64, begin+i, n);