From b7e1307080151df7bceb1f581f932378a667dd7a Mon Sep 17 00:00:00 2001 From: avan989 Date: Wed, 9 Oct 2019 11:20:54 -0400 Subject: [PATCH] Fix #298, fix inifinite loop --- fsw/cfe-core/src/fs/cfe_fs_decompress.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fsw/cfe-core/src/fs/cfe_fs_decompress.c b/fsw/cfe-core/src/fs/cfe_fs_decompress.c index 7fc02c726..4d6bc5419 100644 --- a/fsw/cfe-core/src/fs/cfe_fs_decompress.c +++ b/fsw/cfe-core/src/fs/cfe_fs_decompress.c @@ -284,16 +284,14 @@ int16 FS_gz_fill_inbuf_Reentrant( CFE_FS_Decompress_State_t *State ) { len = OS_read( State->srcFile_fd, (int8*)State->inbuf + State->insize, INBUFSIZ - State->insize ); - if ( len == 0 || len == EOF || len == OS_FS_ERROR ) break; + if ( len <= 0 ) break; State->insize += len; } while ( State->insize < INBUFSIZ ); - if ( State->insize == 0 ) return EOF; - - if ( len == OS_FS_ERROR ) + if ( State->insize == 0 || len < 0) { State->Error = CFE_FS_GZIP_READ_ERROR; return EOF;