From 69865879b4871a86e20e146a9e60db6a545ed2b1 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 24 Jul 2018 11:21:33 -0700 Subject: [PATCH] Fix bug in const String& AsyncWebServerRequest::arg(const __FlashStringHelper * data) const (#334) Fixes crash in AsyncWebServerRequest::arg with flash string param (eg: `request->arg(F(""))` crashes). Solution is to call `strcpy_P` instead of `strcpy`, since the variable `p` is of type `PGM_P` and not `char *`. --- src/WebRequest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebRequest.cpp b/src/WebRequest.cpp index 72bdfa1..dbcb927 100644 --- a/src/WebRequest.cpp +++ b/src/WebRequest.cpp @@ -894,7 +894,7 @@ const String& AsyncWebServerRequest::arg(const __FlashStringHelper * data) const size_t n = strlen_P(p); char * name = (char*) malloc(n+1); if (name) { - strcpy(name, p); + strcpy_P(name, p); const String & result = arg( String(name) ); free(name); return result;