mbox series

[BlueZ,v1,0/1] shared/util: Fix null pointer dereference in util_ltv_foreach()

Message ID 20240621053404.13984-1-sarveshwar.bajaj@nxp.com
Headers show
Series shared/util: Fix null pointer dereference in util_ltv_foreach() | expand

Message

Sarveshwar Bajaj June 21, 2024, 5:34 a.m. UTC
In the existing code, iov structure is initialized with iov.iov_base = (void *) data.
If data is NULL,casting (void *) NULL to iov_base results in a null pointer dereference.
Inside the loop of util_ltv_foreach, util_iov_pull_u8(&iov, &l) is called to pull uint8_t
values from iov. If iov.iov_base (derived from data) is NULL,attempting to dereference
it in util_iov_pull_u8 will cause a segmentation fault.

Added NULL pointer check for data so it will presvent null pointer dereferncing 

Sarveshwar Bajaj (1):
  shared/util: Fix null pointer dereference in util_ltv_foreach()

 src/shared/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+bluetooth@kernel.org June 25, 2024, 2:10 p.m. UTC | #1
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 21 Jun 2024 11:04:03 +0530 you wrote:
> In the existing code, iov structure is initialized with iov.iov_base = (void *) data.
> If data is NULL,casting (void *) NULL to iov_base results in a null pointer dereference.
> Inside the loop of util_ltv_foreach, util_iov_pull_u8(&iov, &l) is called to pull uint8_t
> values from iov. If iov.iov_base (derived from data) is NULL,attempting to dereference
> it in util_iov_pull_u8 will cause a segmentation fault.
> 
> Added NULL pointer check for data so it will presvent null pointer dereferncing
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1,1/1] shared/util: Fix null pointer dereference in util_ltv_foreach()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e453627223db

You are awesome, thank you!