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/c_strings.c | |
| parent | 817adbf22592955244aecad435ce0555707dba1a (diff) | |
Check return values
Diffstat (limited to 'src/stdlib/c_strings.c')
| -rw-r--r-- | src/stdlib/c_strings.c | 3 |
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; } |
