aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/text.c')
-rw-r--r--src/stdlib/text.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stdlib/text.c b/src/stdlib/text.c
index cc8a4daf..2107c1df 100644
--- a/src/stdlib/text.c
+++ b/src/stdlib/text.c
@@ -1620,7 +1620,8 @@ public void Text$deserialize(FILE *in, void *out, List_t *pointers, const TypeIn
int64_t len = -1;
Int64$deserialize(in, &len, pointers, &Int64$info);
char *buf = GC_MALLOC_ATOMIC((size_t)len+1);
- fread(buf, sizeof(char), (size_t)len, in);
+ if (fread(buf, sizeof(char), (size_t)len, in) != (size_t)len)
+ fail("Not enough data in stream to deserialize");
buf[len+1] = '\0';
*(Text_t*)out = Text$from_strn(buf, (size_t)len);
}