Here is the fix of the problem:

Use the right type for `len`, avoid segmentation fault

`getline()` requires its second parameter to be `size_t *`. On the amd64
platform the size of `unsigned int` is 4 and the size of `size_t` is 8
bytes. Using a wrong pointer type can lead to a stack variables
corruption (overwriting with zeros) and a segmentation fault later.

See also similar `len` declarations in `_discover_get_pci_raw_sys()` in
the docs and `_discover_get_ata_raw()` / `discover_get_pci_raw_proc()` /
`discover_get_usb_raw()` in the source code.


** Patch added: "0001-Use-the-right-type-for-len-avoid-segmentation-fault.diff"
   
https://bugs.launchpad.net/discover/+bug/1718687/+attachment/4954403/+files/0001-Use-the-right-type-for-len-avoid-segmentation-fault.diff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1718687

Title:
  crash on amd64

To manage notifications about this bug go to:
https://bugs.launchpad.net/discover/+bug/1718687/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to