提交 a50bce82 编写于 作者: A Andy Polyakov

Sanitize usage of <ctype.h> functions. It's important that characters

are passed zero-extended, not sign-extended.
PR: 2682
上级 713f4911
......@@ -2561,7 +2561,7 @@ static int get_certificate_status(const char *serial, CA_DB *db)
/* Make it Upper Case */
for (i=0; row[DB_serial][i] != '\0'; i++)
row[DB_serial][i] = toupper(row[DB_serial][i]);
row[DB_serial][i] = toupper((unsigned char)row[DB_serial][i]);
ok=1;
......
......@@ -763,7 +763,7 @@ int MAIN(int argc, char **argv)
psk_key=*(++argv);
for (j = 0; j < strlen(psk_key); j++)
{
if (isxdigit((int)psk_key[j]))
if (isxdigit((unsigned char)psk_key[j]))
continue;
BIO_printf(bio_err,"Not a hex number '%s'\n",*argv);
goto bad;
......
......@@ -1219,7 +1219,7 @@ int MAIN(int argc, char *argv[])
psk_key=*(++argv);
for (i=0; i<strlen(psk_key); i++)
{
if (isxdigit((int)psk_key[i]))
if (isxdigit((unsigned char)psk_key[i]))
continue;
BIO_printf(bio_err,"Not a hex number '%s'\n",*argv);
goto bad;
......
......@@ -801,7 +801,7 @@ static MIME_HEADER *mime_hdr_new(char *name, char *value)
if(name) {
if(!(tmpname = BUF_strdup(name))) return NULL;
for(p = tmpname ; *p; p++) {
c = *p;
c = (unsigned char)*p;
if(isupper(c)) {
c = tolower(c);
*p = c;
......@@ -811,7 +811,7 @@ static MIME_HEADER *mime_hdr_new(char *name, char *value)
if(value) {
if(!(tmpval = BUF_strdup(value))) return NULL;
for(p = tmpval ; *p; p++) {
c = *p;
c = (unsigned char)*p;
if(isupper(c)) {
c = tolower(c);
*p = c;
......@@ -835,7 +835,7 @@ static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value)
tmpname = BUF_strdup(name);
if(!tmpname) return 0;
for(p = tmpname ; *p; p++) {
c = *p;
c = (unsigned char)*p;
if(isupper(c)) {
c = tolower(c);
*p = c;
......
......@@ -123,7 +123,7 @@ static int pkey_gost_ctrl94_str(EVP_PKEY_CTX *ctx,
}
if (strlen(value) == 1)
{
switch(toupper(value[0]))
switch(toupper((unsigned char)value[0]))
{
case 'A':
param_nid = NID_id_GostR3410_94_CryptoPro_A_ParamSet;
......@@ -142,9 +142,9 @@ static int pkey_gost_ctrl94_str(EVP_PKEY_CTX *ctx,
break;
}
}
else if ((strlen(value) == 2) && (toupper(value[0]) == 'X'))
else if ((strlen(value) == 2) && (toupper((unsigned char)value[0]) == 'X'))
{
switch (toupper(value[1]))
switch (toupper((unsigned char)value[1]))
{
case 'A':
param_nid = NID_id_GostR3410_94_CryptoPro_XchA_ParamSet;
......@@ -198,7 +198,7 @@ static int pkey_gost_ctrl01_str(EVP_PKEY_CTX *ctx,
}
if (strlen(value) == 1)
{
switch(toupper(value[0]))
switch(toupper((unsigned char)value[0]))
{
case 'A':
param_nid = NID_id_GostR3410_2001_CryptoPro_A_ParamSet;
......@@ -217,9 +217,9 @@ static int pkey_gost_ctrl01_str(EVP_PKEY_CTX *ctx,
break;
}
}
else if ((strlen(value) == 2) && (toupper(value[0]) == 'X'))
else if ((strlen(value) == 2) && (toupper((unsigned char)value[0]) == 'X'))
{
switch (toupper(value[1]))
switch (toupper((unsigned char)value[1]))
{
case 'A':
param_nid = NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册