lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d91329cf-7b88-49e1-8ede-4ea5d7efc0d0@linaro.org>
Date:   Tue, 22 Nov 2022 12:29:28 +0100
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Martin Faltesek <mfaltesek@...gle.com>, kuba@...nel.org,
        netdev@...r.kernel.org, linux-nfc@...ts.01.org, davem@...emloft.net
Cc:     martin.faltesek@...il.com, christophe.ricard@...il.com,
        groeck@...gle.com, jordy@...ing.systems, krzk@...nel.org,
        sameo@...ux.intel.com, theflamefire89@...il.com,
        duoming@....edu.cn, Denis Efremov <denis.e.efremov@...cle.com>
Subject: Re: [PATCH net v2 3/3] nfc: st-nci: fix incorrect sizing calculations
 in EVT_TRANSACTION

On 22/11/2022 01:42, Martin Faltesek wrote:
> The transaction buffer is allocated by using the size of the packet buf,
> and subtracting two which seems intended to remove the two tags which are
> not present in the target structure. This calculation leads to under
> counting memory because of differences between the packet contents and the
> target structure. The aid_len field is a u8 in the packet, but a u32 in
> the structure, resulting in at least 3 bytes always being under counted.
> Further, the aid data is a variable length field in the packet, but fixed
> in the structure, so if this field is less than the max, the difference is
> added to the under counting.
> 
> To fix, perform validation checks progressively to safely reach the
> next field, to determine the size of both buffers and verify both tags.
> Once all validation checks pass, allocate the buffer and copy the data.
> This eliminates freeing memory on the error path, as validation checks are
> moved ahead of memory allocation.
> 
> Reported-by: Denis Efremov <denis.e.efremov@...cle.com>
> Reviewed-by: Guenter Roeck <groeck@...gle.com>
> Fixes: 5d1ceb7f5e56 ("NFC: st21nfcb: Add HCI transaction event support")
> Signed-off-by: Martin Faltesek <mfaltesek@...gle.com>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ