File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- * Authored by Alex Hultman, 2018-2020 .
2+ * Authored by Alex Hultman, 2018-2024 .
33 * Intellectual property of third-party.
44
55 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -199,18 +199,18 @@ struct HttpParser {
199199 /* This guy really has only 30 bits since we reserve two highest bits to chunked encoding parsing state */
200200 uint64_t remainingStreamingBytes = 0 ;
201201
202- /* Returns UINT_MAX on error. Maximum 999999999 is allowed. */
202+ /* Returns UINT64_MAX on error. Maximum 999999999 is allowed. */
203203 static uint64_t toUnsignedInteger (std::string_view str) {
204204 /* We assume at least 64-bit integer giving us safely 999999999999999999 (18 number of 9s) */
205205 if (str.length () > 18 ) {
206- return UINT_MAX ;
206+ return UINT64_MAX ;
207207 }
208208
209209 uint64_t unsignedIntegerValue = 0 ;
210210 for (char c : str) {
211211 /* As long as the letter is 0-9 we cannot overflow. */
212212 if (c < ' 0' || c > ' 9' ) {
213- return UINT_MAX ;
213+ return UINT64_MAX ;
214214 }
215215 unsignedIntegerValue = unsignedIntegerValue * 10ull + ((unsigned int ) c - (unsigned int ) ' 0' );
216216 }
@@ -517,7 +517,7 @@ struct HttpParser {
517517 }
518518 } else if (contentLengthString.length ()) {
519519 remainingStreamingBytes = toUnsignedInteger (contentLengthString);
520- if (remainingStreamingBytes == UINT_MAX ) {
520+ if (remainingStreamingBytes == UINT64_MAX ) {
521521 /* Parser error */
522522 return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
523523 }
You can’t perform that action at this time.
0 commit comments