ref: bb1a24b22e7fea0d39af635dd28dc7f9d2ebbae6
parent: f60f290b066b86358f3f55c9ebe31e77239e8c21
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Oct 5 16:33:46 EDT 2017
libsec: allow \r\n terminated lines in decodePEM()
--- a/sys/src/libsec/port/decodepem.c
+++ b/sys/src/libsec/port/decodepem.c
@@ -25,13 +25,15 @@
t++;
if(strncmp(tt, "-----BEGIN ", STRLEN("-----BEGIN ")) == 0 && strncmp(&tt[STRLEN("-----BEGIN ")], type, n) == 0- && strncmp(&tt[STRLEN("-----BEGIN ")+n], "-----\n", STRLEN("-----\n")) == 0)+ && strncmp(&tt[STRLEN("-----BEGIN ")+n], "-----", STRLEN("-----")) == 0+ && strchr("\r\n", tt[STRLEN("-----BEGIN ")+n+STRLEN("-----")]) != nil)break;
}
for(tt = t; tt != nil && tt < e; tt++){ if(strncmp(tt, "-----END ", STRLEN("-----END ")) == 0 && strncmp(&tt[STRLEN("-----END ")], type, n) == 0- && strncmp(&tt[STRLEN("-----END ")+n], "-----\n", STRLEN("-----\n")) == 0)+ && strncmp(&tt[STRLEN("-----END ")+n], "-----", STRLEN("-----")) == 0+ && strchr("\r\n", tt[STRLEN("-----END ")+n+STRLEN("-----")]) != nil)break;
tt = strchr(tt, '\n');
if(tt == nil)
--
⑨