summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-01-10 11:37:59 -0800
committerGitHub <noreply@github.com>2020-01-10 11:37:59 -0800
commit8708d3dc45ba48391e867fbda70de2ff4084f302 (patch)
tree9aa96479f6117a381043c6439dbf2dddcced44c0 /py
parentd7c6d9cabdbb9531b2852d53efd38da11c0794ca (diff)
parent1c6efb9e662fcfb59afa9cac6c562082248a7560 (diff)
Merge pull request #2461 from jepler/urandom-hardfaults
Urandom hardfaults
Diffstat (limited to 'py')
-rw-r--r--py/vstr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/vstr.c b/py/vstr.c
index 869b27805..91cd7f584 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -50,6 +50,9 @@ void vstr_init(vstr_t *vstr, size_t alloc) {
// Init the vstr so it allocs exactly enough ram to hold a null-terminated
// string of the given length, and set the length.
void vstr_init_len(vstr_t *vstr, size_t len) {
+ if(len == SIZE_MAX) {
+ m_malloc_fail(len);
+ }
vstr_init(vstr, len + 1);
vstr->len = len;
}