allow no end of line on last line of PEMs
This commit is contained in:
parent
d4035e5f62
commit
da386691a1
@ -123,7 +123,6 @@ int pbkdf2_test(void);
|
|||||||
int ecc_test(void);
|
int ecc_test(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int PemToDer(const char* inName, const char* outName);
|
|
||||||
|
|
||||||
|
|
||||||
static void err_sys(const char* msg, int es)
|
static void err_sys(const char* msg, int es)
|
||||||
|
19
src/ssl.c
19
src/ssl.c
@ -895,6 +895,7 @@ int AddCA(CYASSL_CERT_MANAGER* cm, buffer der, int type, int verify)
|
|||||||
char* headerEnd;
|
char* headerEnd;
|
||||||
char* footerEnd;
|
char* footerEnd;
|
||||||
char* consumedEnd;
|
char* consumedEnd;
|
||||||
|
char* bufferEnd = (char*)(buff + longSz);
|
||||||
long neededSz;
|
long neededSz;
|
||||||
int pkcs8 = 0;
|
int pkcs8 = 0;
|
||||||
int pkcs8Enc = 0;
|
int pkcs8Enc = 0;
|
||||||
@ -965,7 +966,7 @@ int AddCA(CYASSL_CERT_MANAGER* cm, buffer der, int type, int verify)
|
|||||||
}
|
}
|
||||||
headerEnd += XSTRLEN(header);
|
headerEnd += XSTRLEN(header);
|
||||||
|
|
||||||
/* get next line */
|
/* eat end of line */
|
||||||
if (headerEnd[0] == '\n')
|
if (headerEnd[0] == '\n')
|
||||||
headerEnd++;
|
headerEnd++;
|
||||||
else if (headerEnd[1] == '\n')
|
else if (headerEnd[1] == '\n')
|
||||||
@ -1023,13 +1024,15 @@ int AddCA(CYASSL_CERT_MANAGER* cm, buffer der, int type, int verify)
|
|||||||
|
|
||||||
consumedEnd = footerEnd + XSTRLEN(footer);
|
consumedEnd = footerEnd + XSTRLEN(footer);
|
||||||
|
|
||||||
/* get next line */
|
if (consumedEnd < bufferEnd) { /* handle no end of line on last line */
|
||||||
if (consumedEnd[0] == '\n')
|
/* eat end of line */
|
||||||
consumedEnd++;
|
if (consumedEnd[0] == '\n')
|
||||||
else if (consumedEnd[1] == '\n')
|
consumedEnd++;
|
||||||
consumedEnd += 2;
|
else if (consumedEnd[1] == '\n')
|
||||||
else
|
consumedEnd += 2;
|
||||||
return SSL_BAD_FILE;
|
else
|
||||||
|
return SSL_BAD_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
if (info)
|
if (info)
|
||||||
info->consumed = (long)(consumedEnd - (char*)buff);
|
info->consumed = (long)(consumedEnd - (char*)buff);
|
||||||
|
Loading…
Reference in New Issue
Block a user