diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-05-06 22:27:59 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-05-06 22:27:59 -0400 |
| commit | 46555c558870e8b96f1ce361d74fc404ca13c471 (patch) | |
| tree | e0b01a6a2b5a99754bbc1ca7131a37a8badc9d54 /src/stdlib/text.c | |
| parent | 817adbf22592955244aecad435ce0555707dba1a (diff) | |
Check return values
Diffstat (limited to 'src/stdlib/text.c')
| -rw-r--r-- | src/stdlib/text.c | 3 |
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); } |
