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:
parent
fc71230a31
commit
69865879b4
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue