cast to unsigned char for ctype calls on signed-char input
This commit is contained in:
1 parent
f651a6f34f
commit
942e458bf5
5 files changed
+10
-8
No files matched your search
+1
-1
@@ -792,7 +792,7 @@ bool CClient::IsValidIdentifier(const CString& sIdentifier) {
|
||||
|
||||
const char* p = sIdentifier.c_str();
|
||||
while (*p) {
|
||||
if (*p != '_' && *p != '-' && !isalnum(*p)) {
|
||||
if (*p != '_' && *p != '-' && !isalnum((unsigned char)*p)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ bool CIRCNetwork::IsValidNetwork(const CString& sNetwork) {
|
||||
|
||||
const char* p = sNetwork.c_str();
|
||||
while (*p) {
|
||||
if (*p != '_' && *p != '-' && !isalnum(*p)) {
|
||||
if (*p != '_' && *p != '-' && !isalnum((unsigned char)*p)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -254,8 +254,9 @@ void CMessage::InitTime() {
|
||||
}
|
||||
|
||||
void CMessage::InitType() {
|
||||
if (m_sCommand.length() == 3 && isdigit(m_sCommand[0]) &&
|
||||
isdigit(m_sCommand[1]) && isdigit(m_sCommand[2])) {
|
||||
if (m_sCommand.length() == 3 && isdigit((unsigned char)m_sCommand[0]) &&
|
||||
isdigit((unsigned char)m_sCommand[1]) &&
|
||||
isdigit((unsigned char)m_sCommand[2])) {
|
||||
m_eType = Type::Numeric;
|
||||
} else if (m_sCommand.Equals("PRIVMSG")) {
|
||||
CString sParam = GetParam(1);
|
||||
|
||||
+3
-2
@@ -921,7 +921,8 @@ bool CUser::IsValidUserName(const CString& sUsername) {
|
||||
}
|
||||
|
||||
while (*p) {
|
||||
if (*p != '@' && *p != '.' && *p != '-' && *p != '_' && !isalnum(*p)) {
|
||||
if (*p != '@' && *p != '.' && *p != '-' && *p != '_' &&
|
||||
!isalnum((unsigned char)*p)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1402,7 +1403,7 @@ bool CUser::SetStatusPrefix(const CString& s) {
|
||||
bool CUser::SetLanguage(const CString& s) {
|
||||
// They look like ru-RU
|
||||
for (char c : s) {
|
||||
if (isalpha(c) || c == '-' || c == '_') {
|
||||
if (isalpha((unsigned char)c) || c == '-' || c == '_') {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -220,7 +220,7 @@ bool CString::WildCmp(const CString& sWild, CaseSensitivity cs) const {
|
||||
CString& CString::MakeUpper() {
|
||||
for (char& c : *this) {
|
||||
// TODO use unicode
|
||||
c = (char)toupper(c);
|
||||
c = (char)toupper((unsigned char)c);
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -229,7 +229,7 @@ CString& CString::MakeUpper() {
|
||||
CString& CString::MakeLower() {
|
||||
for (char& c : *this) {
|
||||
// TODO use unicode
|
||||
c = (char)tolower(c);
|
||||
c = (char)tolower((unsigned char)c);
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
||||
Reference in new issue
Block a user