mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-09 00:53:16 +00:00
jffs2: Fix return code of rtime compress
The RTEMS and Linux JFFS2 compression support have a slightly different
interface. This fixes a bug introduced by:
commit 17c3d536ca
Author: Yang Yang <yang.yang29@zte.com.cn>
Date: Thu Jan 28 02:55:35 2021 -0800
jffs2: check the validity of dstlen in jffs2_zlib_compress()
KASAN reports a BUG when download file in jffs2 filesystem.It is
because when dstlen == 1, cpage_out will write array out of bounds.
Actually, data will not be compressed in jffs2_zlib_compress() if
data's length less than 4.
This commit is contained in:
@@ -45,7 +45,7 @@ uint16_t rtems_jffs2_compressor_rtime_compress(
|
||||
(void) self;
|
||||
|
||||
if (*dstlen <= 3)
|
||||
return -1;
|
||||
return JFFS2_COMPR_NONE;
|
||||
|
||||
memset(positions,0,sizeof(positions));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user