This code calculates an allocation size by multiplying a user input by a sizeof expression.
Firstly, there is no multiplication of any user input in play.
All we are doing is making a duplicate of the packet we received.
The upper bound is also checked on line 3451 which I added just to try and curcumvent this issue. The code can receive the packet from 3 different sources, but they all will hit this line before any attempt to duplicate the packet is made.
In the cases where there is multiplication in play in dhcpcd, we use the function reallocarray from BSD libc which your example should use anyway.
URL to the alert on the project page on LGTM.com
https://lgtm.com/projects/g/rsmarples/dhcpcd/snapshot/e7f194885e43765a5d6cae01fd7fa30e075843cd/files/src/dhcp.c?sort=name&dir=ASC&mode=heatmap#x4eac3e1b4fba2f35:1
This code calculates an allocation size by multiplying a user input by a sizeof expression.
Firstly, there is no multiplication of any user input in play.
All we are doing is making a duplicate of the packet we received.
The upper bound is also checked on line 3451 which I added just to try and curcumvent this issue. The code can receive the packet from 3 different sources, but they all will hit this line before any attempt to duplicate the packet is made.
In the cases where there is multiplication in play in dhcpcd, we use the function reallocarray from BSD libc which your example should use anyway.
URL to the alert on the project page on LGTM.com
https://lgtm.com/projects/g/rsmarples/dhcpcd/snapshot/e7f194885e43765a5d6cae01fd7fa30e075843cd/files/src/dhcp.c?sort=name&dir=ASC&mode=heatmap#x4eac3e1b4fba2f35:1