Cetching segfault, if no password for pem key given.

FossilOrigin-Name: a996a773e8001040020a438ab2a71ba646f1dff16b886989d1f9a189e00514e9
This commit is contained in:
7u83@mail.ru 2015-01-13 19:53:39 +00:00
parent ce01c6327e
commit 04fa8f58f9
1 changed files with 8 additions and 3 deletions

View File

@ -50,9 +50,14 @@ static void dtls_debug_cb(int write_p,int version,int type, const void * buf,siz
int pem_passwd_cb(char *buf, int size, int rwflag, void *password)
{
strncpy(buf, (char *)(password), size);
buf[size - 1] = '\0';
return(strlen(buf));
if (!password){
cw_dbg(DBG_DTLS, "DTLS - No password given to decrypt privat key");
return 0;
}
strncpy(buf, (char *)(password), size);
buf[size - 1] = '\0';
return(strlen(buf));
}
/* Set up ephemeral RSA stuff */