diff --git a/fuzzing/Http.cpp b/fuzzing/Http.cpp index fe77755..2a93294 100644 --- a/fuzzing/Http.cpp +++ b/fuzzing/Http.cpp @@ -97,12 +97,17 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } /* Parse it */ - httpParser.consumePostPadded((char *) data, size, user, reserved, [](void *s, uWS::HttpRequest *httpRequest) -> void * { + httpParser.consumePostPadded((char *) data, size, user, reserved, [reserved](void *s, uWS::HttpRequest *httpRequest) -> void * { readBytes(httpRequest->getHeader(httpRequest->getUrl())); readBytes(httpRequest->getMethod()); readBytes(httpRequest->getQuery()); +#ifdef UWS_WITH_PROXY + auto *pp = (uWS::ProxyParser *) reserved; + readBytes(pp->getSourceAddress()); +#endif + /* Route the method and URL in two passes */ staticData.router.getUserData() = {}; if (!staticData.router.route(httpRequest->getMethod(), httpRequest->getUrl())) { diff --git a/src/HttpResponse.h b/src/HttpResponse.h index 2e8071c..954b5a4 100644 --- a/src/HttpResponse.h +++ b/src/HttpResponse.h @@ -70,15 +70,6 @@ private: Super::write(buf, length); } - /* Write an unsigned 32-bit integer */ - void writeUnsigned(unsigned int value) { - char buf[10]; - int length = utils::u32toa(value, buf); - - /* For now we do this copy */ - Super::write(buf, length); - } - /* When we are done with a response we mark it like so */ void markDone(HttpResponseData *httpResponseData) { httpResponseData->onAborted = nullptr; @@ -376,10 +367,10 @@ public: } /* Write an HTTP header with unsigned int value */ - HttpResponse *writeHeader(std::string_view key, unsigned int value) { + HttpResponse *writeHeader(std::string_view key, uint64_t value) { Super::write(key.data(), (int) key.length()); Super::write(": ", 2); - writeUnsigned(value); + writeUnsigned64(value); Super::write("\r\n", 2); return this; } diff --git a/src/Utilities.h b/src/Utilities.h index c9be037..2fbea32 100644 --- a/src/Utilities.h +++ b/src/Utilities.h @@ -43,23 +43,6 @@ inline int u32toaHex(uint32_t value, char *dst) { return ret; } -inline int u32toa(uint32_t value, char *dst) { - char temp[10]; - char *p = temp; - do { - *p++ = (char) ((value % 10) + '0'); - value /= 10; - } while (value > 0); - - int ret = (int) (p - temp); - - do { - *dst++ = *--p; - } while (p != temp); - - return ret; -} - inline int u64toa(uint64_t value, char *dst) { char temp[20]; char *p = temp;