mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
DHCPClient: Handle invalid DHCP responses more gracefully
This commit is contained in:
parent
9213d1e926
commit
6e101adc28
Notes:
sideshowbarker
2024-07-18 18:39:18 +09:00
Author: https://github.com/gunnarbeutner
Commit: 6e101adc28
Pull-request: https://github.com/SerenityOS/serenity/pull/6888
Reviewed-by: https://github.com/awesomekling
1 changed files with 5 additions and 1 deletions
|
@ -287,7 +287,11 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
|
|||
|
||||
dbgln_if(DHCPV4CLIENT_DEBUG, "Here are the options: {}", options.to_string());
|
||||
|
||||
auto value = options.get<DHCPMessageType>(DHCPOption::DHCPMessageType).value();
|
||||
auto value_or_error = options.get<DHCPMessageType>(DHCPOption::DHCPMessageType);
|
||||
if (!value_or_error.has_value())
|
||||
return;
|
||||
|
||||
auto value = value_or_error.value();
|
||||
switch (value) {
|
||||
case DHCPMessageType::DHCPOffer:
|
||||
handle_offer(packet, options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue