aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/c_strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/c_strings.c')
-rw-r--r--src/stdlib/c_strings.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stdlib/c_strings.c b/src/stdlib/c_strings.c
index c153a8a9..860a69ff 100644
--- a/src/stdlib/c_strings.c
+++ b/src/stdlib/c_strings.c
@@ -64,7 +64,8 @@ static void CString$deserialize(FILE *in, void *out, List_t *pointers, const Typ
int64_t len = -1;
Int64$deserialize(in, &len, pointers, &Int64$info);
char *str = GC_MALLOC_ATOMIC((size_t)len+1);
- fread(str, sizeof(char), (size_t)len, in);
+ if (fread(str, sizeof(char), (size_t)len, in) != (size_t)len)
+ fail("Not enough data in stream to deserialize");
str[len+1] = '\0';
*(const char**)out = str;
}