[LEDE-DEV] [LEDE-DEV,2/3] fstools: fix potential memory leak

John Crispin john at phrozen.org
Mon Apr 2 08:25:35 PDT 2018



On 29/03/18 10:25, rosysong at rosinson.com wrote:
> Fix potential memory leak in fstools
>
> Signed-off-by: Rosy Song <rosysong at rosinson.com>
Hi,

the description is wrong, this fixes a potential null pointer deref and 
i dont really see how probing of a FS would work without a magic so we 
probably wont ever hit this case ?

     John

> ---
>   libblkid-tiny/libblkid-tiny.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libblkid-tiny/libblkid-tiny.c b/libblkid-tiny/libblkid-tiny.c
> index ccfaf63..12cab6f 100644
> --- a/libblkid-tiny/libblkid-tiny.c
> +++ b/libblkid-tiny/libblkid-tiny.c
> @@ -282,7 +282,7 @@ int probe_block(char *block, struct blkid_struct_probe *pr)
>   
>   		mag = &idinfos[i]->magics[0];
>   
> -		while (mag->magic) {
> +		while (mag && mag->magic) {
>   			int off = (mag->kboff * 1024) + mag->sboff;
>   			char magic[32] = { 0 };
>   
> -- 
> 2.13.3
>
>
>
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev




More information about the Lede-dev mailing list