Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

Commit 6986587

Browse files
CarlosRDominme-no-dev
authored andcommitted
Fix bug in const String& AsyncWebServerRequest::arg(const __FlashStringHelper * data) const (me-no-dev#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 *`.
1 parent fc71230 commit 6986587

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/WebRequest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ const String& AsyncWebServerRequest::arg(const __FlashStringHelper * data) const
894894
size_t n = strlen_P(p);
895895
char * name = (char*) malloc(n+1);
896896
if (name) {
897-
strcpy(name, p);
897+
strcpy_P(name, p);
898898
const String & result = arg( String(name) );
899899
free(name);
900900
return result;

0 commit comments

Comments
 (0)