diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-10-05 20:33:46 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-10-05 20:33:46 +0200 |
commit | 5f42da15355e3548634b778271251e7d078f01e6 (patch) | |
tree | 7ff8c266940a16a3130f977af89b44b1dbd3b1d0 /sys/src/libsec | |
parent | 99700fb02476489385f54ff281b623a4d86c4ab0 (diff) |
libsec: allow \r\n terminated lines in decodePEM()
Diffstat (limited to 'sys/src/libsec')
-rw-r--r-- | sys/src/libsec/port/decodepem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/src/libsec/port/decodepem.c b/sys/src/libsec/port/decodepem.c index 2f4494714..b2df25a48 100644 --- a/sys/src/libsec/port/decodepem.c +++ b/sys/src/libsec/port/decodepem.c @@ -25,13 +25,15 @@ decodePEM(char *s, char *type, int *len, char **new_s) 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) |