Add input guards to fortio_fread_buffer for parity with resdata PR #1189

Reject null buffers and negative buffer sizes up front, returning false instead of risking a null dereference or hitting util_abort. The buffer-overflow protection from the upstream fix is already present via #14144; these two input-validation guards are the remaining delta.
This commit is contained in:
Magne Sjaastad committed 2026-06-11 22:26:07 +02:00
1 parent 3be81f7103
commit 3a3a53ff0f
1 file changed
+5
+5
View File
@@ -550,6 +550,11 @@ static int fortio_fread_record(fortio_type *fortio , char *buffer , int max_reco
*/
bool fortio_fread_buffer(fortio_type * fortio, char * buffer , int buffer_size) {
if (buffer == NULL && buffer_size != 0)
return false;
if (buffer_size < 0)
return false;
int total_bytes_read = 0;
while (true) {