Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Multipart.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace uWS {
/* Consumes a token from the line. Will "unquote" strings */
std::string_view getToken() {
/* Strip whitespace */
while (remainingLine.length() && isspace(remainingLine[0])) {
while (remainingLine.length() && isspace((unsigned char) remainingLine[0])) {
remainingLine.remove_prefix(1);
}

Expand Down Expand Up @@ -104,7 +104,7 @@ namespace uWS {
std::string_view token = remainingLine;

int tokenLength = 0;
while (remainingLine.length() && remainingLine[0] != ';' && remainingLine[0] != '=' && !isspace(remainingLine[0])) {
while (remainingLine.length() && remainingLine[0] != ';' && remainingLine[0] != '=' && !isspace((unsigned char) remainingLine[0])) {
remainingLine.remove_prefix(1);
tokenLength++;
}
Expand Down
6 changes: 3 additions & 3 deletions src/WebSocketExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ struct ExtensionsParser {
int maxWindowBits = 0;

int getToken(const char *&in, const char *stop) {
while (in != stop && !isalnum(*in)) {
while (in != stop && !isalnum((unsigned char) *in)) {
in++;
}

/* Don't care more than this for now */
static_assert(SHRT_MIN > INT_MIN, "Integer overflow fix is invalid for this platform, report this as a bug!");

int hashedToken = 0;
while (in != stop && (isalnum(*in) || *in == '-' || *in == '_')) {
if (isdigit(*in)) {
while (in != stop && (isalnum((unsigned char) *in) || *in == '-' || *in == '_')) {
if (isdigit((unsigned char) *in)) {
/* This check is a quick and incorrect fix for integer overflow
* in oss-fuzz but we don't care as it doesn't matter either way */
if (hashedToken > SHRT_MIN && hashedToken < SHRT_MAX) {
Expand Down
Loading