mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
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:
1 parent
3be81f7103
commit
3a3a53ff0f
1 file changed
+5
Vendored
+5
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user