summaryrefslogtreecommitdiffstats
path: root/scene/main/http_request.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-09-29 15:58:25 +0200
committerGitHub <noreply@github.com>2021-09-29 15:58:25 +0200
commit5e609d0e8cecedc68d842fd9f1171d74c4584028 (patch)
tree1cb7a4a2cb77048952f1e37d42ec3f8fb3b69b7b /scene/main/http_request.cpp
parentc1f59139b40f40907b0507a84ec3515c5cc4794b (diff)
parent9dd0d3f550a0940dd53833666cd082e81aab8eff (diff)
downloadredot-engine-5e609d0e8cecedc68d842fd9f1171d74c4584028.tar.gz
Merge pull request #53211 from timothyqiu/request-ub
Diffstat (limited to 'scene/main/http_request.cpp')
-rw-r--r--scene/main/http_request.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index f24d880045..14fd14dd18 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -104,9 +104,11 @@ Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_h
CharString charstr = p_request_data.utf8();
size_t len = charstr.length();
- raw_data.resize(len);
- uint8_t *w = raw_data.ptrw();
- memcpy(w, charstr.ptr(), len);
+ if (len > 0) {
+ raw_data.resize(len);
+ uint8_t *w = raw_data.ptrw();
+ memcpy(w, charstr.ptr(), len);
+ }
return request_raw(p_url, p_custom_headers, p_ssl_validate_domain, p_method, raw_data);
}