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("<arg name>"))` crashes). Solution is to call `strcpy_P` instead of `strcpy`, since the variable `p` is of type `PGM_P` and not `char *`.
This commit is contained in:
Carlos Ruiz 2018-07-24 11:21:33 -07:00 committed by Me No Dev
parent fc71230a31
commit 69865879b4
1 changed files with 1 additions and 1 deletions

View File

@ -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;